@@ -15,11 +15,17 @@ JavaScript code can be compiled and run immediately or compiled, saved, and run
15
15
later.
16
16
17
17
## Class: vm.Script
18
+ <!-- YAML
19
+ added: v0.3.1
20
+ -->
18
21
19
22
Instances of the ` vm.Script ` class contain precompiled scripts that can be
20
23
executed in specific sandboxes (or "contexts").
21
24
22
25
### new vm.Script(code, options)
26
+ <!-- YAML
27
+ added: v0.3.1
28
+ -->
23
29
24
30
* ` code ` {string} The JavaScript code to compile.
25
31
* ` options `
@@ -52,6 +58,9 @@ that the `code` is not bound to any global object; rather, it is bound before
52
58
each run, just for that run.
53
59
54
60
### script.runInContext(contextifiedSandbox[ , options] )
61
+ <!-- YAML
62
+ added: v0.3.1
63
+ -->
55
64
56
65
* ` contextifiedSandbox ` {Object} A [ contextified] [ ] object as returned by the
57
66
` vm.createContext() ` method.
@@ -99,6 +108,9 @@ console.log(util.inspect(sandbox));
99
108
```
100
109
101
110
### script.runInNewContext([ sandbox] [ , options ] )
111
+ <!-- YAML
112
+ added: v0.3.1
113
+ -->
102
114
103
115
* ` sandbox ` {Object} An object that will be [ contextified] [ ] . If ` undefined ` , a
104
116
new object will be created.
@@ -141,6 +153,9 @@ console.log(util.inspect(sandboxes));
141
153
```
142
154
143
155
### script.runInThisContext([ options] )
156
+ <!-- YAML
157
+ added: v0.3.1
158
+ -->
144
159
145
160
* ` options ` {Object}
146
161
* ` filename ` {string} Specifies the filename used in stack traces produced
@@ -180,6 +195,9 @@ console.log(globalVar);
180
195
```
181
196
182
197
## vm.createContext([ sandbox] )
198
+ <!-- YAML
199
+ added: v0.3.1
200
+ -->
183
201
184
202
* ` sandbox ` {Object}
185
203
@@ -201,6 +219,9 @@ window's global object, then run all `<script>` tags together within the context
201
219
of that sandbox.
202
220
203
221
## vm.isContext(sandbox)
222
+ <!-- YAML
223
+ added: v0.11.7
224
+ -->
204
225
205
226
* ` sandbox ` {Object}
206
227
@@ -250,6 +271,9 @@ console.log(util.inspect(sandbox));
250
271
```
251
272
252
273
## vm.runInDebugContext(code)
274
+ <!-- YAML
275
+ added: v0.11.14
276
+ -->
253
277
254
278
* ` code ` {string} The JavaScript code to compile and run.
255
279
@@ -270,6 +294,9 @@ The `Debug` object can also be made available using the V8-specific
270
294
` --expose_debug_as= ` [ command line option] [ cli.md ] .
271
295
272
296
## vm.runInNewContext(code[ , sandbox] [ , options ] )
297
+ <!-- YAML
298
+ added: v0.3.1
299
+ -->
273
300
274
301
* ` code ` {string} The JavaScript code to compile and run.
275
302
* ` sandbox ` {Object} An object that will be [ contextified] [ ] . If ` undefined ` , a
@@ -312,6 +339,9 @@ console.log(util.inspect(sandbox));
312
339
```
313
340
314
341
## vm.runInThisContext(code[ , options] )
342
+ <!-- YAML
343
+ added: v0.3.1
344
+ -->
315
345
316
346
* ` code ` {string} The JavaScript code to compile and run.
317
347
* ` options `
0 commit comments