diff --git a/doc/api/vm.md b/doc/api/vm.md index 8de2775dccb802..d49081c481d533 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -15,11 +15,17 @@ JavaScript code can be compiled and run immediately or compiled, saved, and run later. ## Class: vm.Script + Instances of the `vm.Script` class contain precompiled scripts that can be executed in specific sandboxes (or "contexts"). ### new vm.Script(code, options) + * `code` {string} The JavaScript code to compile. * `options` @@ -52,6 +58,9 @@ that the `code` is not bound to any global object; rather, it is bound before each run, just for that run. ### script.runInContext(contextifiedSandbox[, options]) + * `contextifiedSandbox` {Object} A [contextified][] object as returned by the `vm.createContext()` method. @@ -99,6 +108,9 @@ console.log(util.inspect(sandbox)); ``` ### script.runInNewContext([sandbox][, options]) + * `sandbox` {Object} An object that will be [contextified][]. If `undefined`, a new object will be created. @@ -141,6 +153,9 @@ console.log(util.inspect(sandboxes)); ``` ### script.runInThisContext([options]) + * `options` {Object} * `filename` {string} Specifies the filename used in stack traces produced @@ -180,6 +195,9 @@ console.log(globalVar); ``` ## vm.createContext([sandbox]) + * `sandbox` {Object} @@ -201,6 +219,9 @@ window's global object, then run all `