Name Description Size 453
require.js Implementation of a CommonJS module loader for workers. Use: // in the .js file loaded by the constructor of the worker importScripts("resource://gre/modules/workers/require.js"); let module = require("resource://gre/modules/worker/myModule.js"); // in myModule.js // Load dependencies let SimpleTest = require("resource://gre/modules/workers/SimpleTest.js"); let Logger = require("resource://gre/modules/workers/Logger.js"); // Define things that will not be exported let someValue = // ... // Export symbols = // ... = // ... Note #1: Properties |fileName| and |stack| of errors triggered from a module contain file names that do not correspond to human-readable module paths. Human readers should rather use properties |moduleName| and |moduleStack|. Note #2: By opposition to some other module loader implementations, this module loader does not enforce separation of global objects. Consequently, if a module modifies a global object (e.g. |String.prototype|), all other modules in the same worker may be affected. 5571