ServerJS/System: Difference between revisions

Jump to navigation Jump to search
m
→‎System Interface Proposal A: updated to reflect the current color choices.
m (→‎Show of Hands: reformatted)
m (→‎System Interface Proposal A: updated to reflect the current color choices.)
Line 1: Line 1:
= System Interface Proposal A =
= System Interface Proposal A =


All platforms support a free variable, "sys", that is an object that may contain the following attributes.  The "sys" variable may be either a global variable, an argument to every module factory function, or inserted into a module scope by some other means.  "sys" may be used for dependency injection in sandboxes, so it may be frozen.  Therefore, the variable must not be reassigned, or modified in interoperable modules, although it may be mutable and reassignable in particular platforms.
All platforms support a free variable, "system", that is an object that may contain the following attributes.  The "system" variable may be either a global variable, an argument to every module factory function, or inserted into a module scope by some other means.  "system" may be used for dependency injection in sandboxes, so it may be frozen.  Therefore, the variable must not be reassigned, or modified in interoperable modules, although it may be mutable and reassignable in particular platforms.


If "sys" contains any of the following names, they must have the corresponding meaning:
If "system" contains any of the following names, they must have the corresponding meaning:


* stdin: the standard input stream, an object with the same API as a file opened with the mode "r" with no encoding.
* stdin: the standard input stream, an object with the same API as a file opened with the mode "r" with no encoding.
* stdout: the standard output stream, an object with the same API as a file opened with the mode "w" with no encoding.
* stdout: the standard output stream, an object with the same API as a file opened with the mode "w" with no encoding.
* stderr: the standard error stream, an object with the same API as a file opened with the mode "w" with no encoding.
* stderr: the standard error stream, an object with the same API as a file opened with the mode "w" with no encoding.
* environment: an Object containing posix-style or CGI environment variables.
* env: an Object containing posix-style or CGI environment variables.
* arguments: an Array containing the command line arguments for the invoking arguments, not including the interpreter/engine but including the path to the program as it was executed.
* args: an Array containing the command line arguments for the invoking arguments, not including the interpreter/engine but including the path to the program as it was executed.
* fs: a file default file system root object conforming to the File System API
* fs: a file default file system root object conforming to the File System API


171

edits

Navigation menu