| 1 | // Copyright (c) 2019-2024 Alexander Medvednikov. All rights reserved. |
| 2 | // Use of this source code is governed by an MIT license |
| 3 | // that can be found in the LICENSE file. |
| 4 | |
| 5 | // This file contains JS functions only present in node.js. |
| 6 | // They have been ported from their TypeScript definitions. |
| 7 | |
| 8 | module builtin |
| 9 | |
| 10 | pub struct JS.node_process { |
| 11 | pub: |
| 12 | arch string |
| 13 | argsv []string |
| 14 | env []string |
| 15 | platform string |
| 16 | version string |
| 17 | // TODO: add all properties |
| 18 | } |
| 19 | |
| 20 | // hack to access process properties |
| 21 | pub fn js_node_process() JS.node_process { |
| 22 | #return process |
| 23 | |
| 24 | return JS.node_process{} |
| 25 | } |
| 26 | |
| 27 | fn JS.process.exit(int) |
| 28 | fn JS.process.stdout.write(string) bool |
| 29 | fn JS.process.stdout.writeln(string) bool |
| 30 | fn JS.process.stderr.write(string) bool |
| 31 | fn JS.process.stderr.writeln(string) bool |
| 32 | |