Runtime
Runtime global object holds information about os, process and runtime.
Runtime.platform
Section titled “Runtime.platform”Returns current platform as a string
Runtime.platform // "linux"Possible values:
linuxwin32darwinfreebsdopenbsdunixunknown
Runtime.pid
Section titled “Runtime.pid”Returns process id (number).
Runtime.pid // 2144Runtime.version
Section titled “Runtime.version”Returns PandJS’s version as a string - semantic version prefixed with v (for example "v1.0.0")
Runtime.version // "v.1.0.3"Runtime.argv
Section titled “Runtime.argv”Returns the script arguments (as an array of strings) to the program.
pand ./your-script.js arg1 arg2 ... argNRuntime.argv.forEach(item => { console.log(`Arg: ${item}`);});
// output:Arg: pandArg: ./your-script.jsArg: arg1Arg arg2...Arg: argNRuntime.cwd()
Section titled “Runtime.cwd()”Returns current working directory as a string.
Runtime.cwd() // "/home/example/Wokrspace"Runtime.exit()
Section titled “Runtime.exit()”Forcefully exits process without waiting for pending operations.
Runtime.exit(1) // exit process with status 1 (error)Runtime.sleep()
Section titled “Runtime.sleep()”Pauses the execution of the main thread for the specified number of milliseconds.
Runtime.sleep(2000)