ServerJS/Modules/Environment: Difference between revisions

m
Added environment.args and require.entry.
m (Added environment.args and require.entry.)
Line 5: Line 5:
* id: the "require" object MAY have an "id" member that must be the normalized identifier of the current module
* id: the "require" object MAY have an "id" member that must be the normalized identifier of the current module
* loader: the "require" object MAY have a "loader" member that is an interface to the object used by "require" to acquire module factory functions.  Tampering with this variable must not alter the behavior of "require".
* loader: the "require" object MAY have a "loader" member that is an interface to the object used by "require" to acquire module factory functions.  Tampering with this variable must not alter the behavior of "require".
* entry: the "require" object MAY have an "entry" member that is the module ID of the module that was the entry point for this sandbox.  Thus the common Python idiom <tt>if __name__ == '__main__':</tt> would be <tt>if (require.id == require.entry)</tt>.




Line 16: Line 17:
* is: any member that has "is" as its first term is reserved for vendor and platform checks like "isRhino", "isJavaScriptCore", "isSpidermonkey", "isBrowser", &c.
* is: any member that has "is" as its first term is reserved for vendor and platform checks like "isRhino", "isJavaScriptCore", "isSpidermonkey", "isBrowser", &c.
* window: the "environment" MAY contain the global "window" object in permissive browser environments
* window: the "environment" MAY contain the global "window" object in permissive browser environments
* args: an optional Array of Strings representing the process arguments.
* global: the "environment" MAY contain a reference to the global object in permissive environments
* global: the "environment" MAY contain a reference to the global object in permissive environments
* posix: reserved for a posix subsystem interface
* posix: reserved for a posix subsystem interface
171

edits