From 7abfb6e8dca59cb92be11209a7e4b7a4c47b1980 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 27 May 2016 04:21:30 +0200 Subject: [PATCH] doc: add `added:` information for vm Ref: https://github.com/nodejs/node/issues/6578 PR-URL: https://github.com/nodejs/node/pull/7011 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Julian Duque --- doc/api/vm.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/doc/api/vm.md b/doc/api/vm.md index d53c8dc8d70850..e014994d75e2a0 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -14,10 +14,16 @@ JavaScript code can be compiled and run immediately or compiled, saved, and run later. ## Class: Script + A class for holding precompiled scripts, and running them in specific sandboxes. ### new vm.Script(code, options) + Creating a new `Script` compiles `code` but does not run it. Instead, the created `vm.Script` object represents this compiled code. This script can be run @@ -40,6 +46,9 @@ The options when creating a script are: execution. If execution is terminated, an [`Error`][] will be thrown. ### script.runInContext(contextifiedSandbox[, options]) + Similar to [`vm.runInContext()`][] but a method of a precompiled `Script` object. `script.runInContext()` runs `script`'s compiled code in @@ -78,6 +87,9 @@ Note that running untrusted code is a tricky business requiring great care. requires a separate process. ### script.runInNewContext([sandbox][, options]) + Similar to [`vm.runInNewContext()`][] but a method of a precompiled `Script` object. `script.runInNewContext()` contextifies `sandbox` if passed or creates a @@ -114,6 +126,9 @@ Note that running untrusted code is a tricky business requiring great care. requires a separate process. ### script.runInThisContext([options]) + Similar to [`vm.runInThisContext()`]() but a method of a precompiled `Script` object. `script.runInThisContext()` runs `script`'s compiled code and returns @@ -155,6 +170,9 @@ The options for running a script are: execution. If execution is terminated, an [`Error`][] will be thrown. ## vm.createContext([sandbox]) + If given a `sandbox` object, will "contextify" that sandbox so that it can be used in calls to [`vm.runInContext()`][] or [`script.runInContext()`][]. Inside @@ -172,6 +190,9 @@ single sandbox representing a window's global object, then run all `