summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir de Turckheim <vlad2t@hotmail.com>2018-10-12 10:25:25 -0700
committerMyles Borins <mylesborins@google.com>2018-12-03 13:32:56 -0500
commit9503365d2045a5ca63dbea62069c76fd287c01f7 (patch)
tree3874b1c06d9d59e21d29910c6fb6ea5f18defb53
parent7f1e0e55f864828ee63674e28f0ecf3110a95c2a (diff)
downloadnode-new-9503365d2045a5ca63dbea62069c76fd287c01f7.tar.gz
vm: clarify timeout option in vm
This updates the documentation to clarify how to use `timeout` in the vm module. PR-URL: https://github.com/nodejs/node/pull/23512 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
-rw-r--r--doc/api/vm.md28
1 files changed, 14 insertions, 14 deletions
diff --git a/doc/api/vm.md b/doc/api/vm.md
index 543f1642f0..892f7b97c3 100644
--- a/doc/api/vm.md
+++ b/doc/api/vm.md
@@ -237,9 +237,9 @@ in the ECMAScript specification.
### module.evaluate([options])
* `options` {Object}
- * `timeout` {number} Specifies the number of milliseconds to evaluate
+ * `timeout` {integer} Specifies the number of milliseconds to evaluate
before terminating execution. If execution is interrupted, an [`Error`][]
- will be thrown.
+ will be thrown. This value must be a strictly positive integer.
* `breakOnSigint` {boolean} If `true`, the execution will be terminated when
`SIGINT` (Ctrl+C) is received. Existing handlers for the event that have
been attached via `process.on('SIGINT')` will be disabled during script
@@ -489,9 +489,9 @@ changes:
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
while compiling the `code`, the line of code causing the error is attached
to the stack trace.
- * `timeout` {number} Specifies the number of milliseconds to execute `code`
+ * `timeout` {integer} Specifies the number of milliseconds to execute `code`
before terminating execution. If execution is terminated, an [`Error`][]
- will be thrown.
+ will be thrown. This value must be a strictly positive integer.
* `breakOnSigint`: if `true`, the execution will be terminated when
`SIGINT` (Ctrl+C) is received. Existing handlers for the
event that have been attached via `process.on('SIGINT')` will be disabled
@@ -552,9 +552,9 @@ changes:
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
while compiling the `code`, the line of code causing the error is attached
to the stack trace.
- * `timeout` {number} Specifies the number of milliseconds to execute `code`
+ * `timeout` {integer} Specifies the number of milliseconds to execute `code`
before terminating execution. If execution is terminated, an [`Error`][]
- will be thrown.
+ will be thrown. This value must be a strictly positive integer.
* `contextName` {string} Human-readable name of the newly created context.
**Default:** `'VM Context i'`, where `i` is an ascending numerical index of
the created context.
@@ -610,9 +610,9 @@ added: v0.3.1
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
while compiling the `code`, the line of code causing the error is attached
to the stack trace.
- * `timeout` {number} Specifies the number of milliseconds to execute `code`
+ * `timeout` {integer} Specifies the number of milliseconds to execute `code`
before terminating execution. If execution is terminated, an [`Error`][]
- will be thrown.
+ will be thrown. This value must be a strictly positive integer.
Runs the compiled code contained by the `vm.Script` within the context of the
current `global` object. Running code does not have access to local scope, but
@@ -757,9 +757,9 @@ Returns `true` if the given `sandbox` object has been [contextified][] using
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
while compiling the `code`, the line of code causing the error is attached
to the stack trace.
- * `timeout` {number} Specifies the number of milliseconds to execute `code`
+ * `timeout` {integer} Specifies the number of milliseconds to execute `code`
before terminating execution. If execution is terminated, an [`Error`][]
- will be thrown.
+ will be thrown. This value must be a strictly positive integer.
The `vm.runInContext()` method compiles `code`, runs it within the context of
the `contextifiedSandbox`, then returns the result. Running code does not have
@@ -804,9 +804,9 @@ added: v0.3.1
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
while compiling the `code`, the line of code causing the error is attached
to the stack trace.
- * `timeout` {number} Specifies the number of milliseconds to execute `code`
+ * `timeout` {integer} Specifies the number of milliseconds to execute `code`
before terminating execution. If execution is terminated, an [`Error`][]
- will be thrown.
+ will be thrown. This value must be a strictly positive integer.
* `contextName` {string} Human-readable name of the newly created context.
**Default:** `'VM Context i'`, where `i` is an ascending numerical index of
the created context.
@@ -858,9 +858,9 @@ added: v0.3.1
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
while compiling the `code`, the line of code causing the error is attached
to the stack trace.
- * `timeout` {number} Specifies the number of milliseconds to execute `code`
+ * `timeout` {integer} Specifies the number of milliseconds to execute `code`
before terminating execution. If execution is terminated, an [`Error`][]
- will be thrown.
+ will be thrown. This value must be a strictly positive integer.
`vm.runInThisContext()` compiles `code`, runs it within the context of the
current `global` and returns the result. Running code does not have access to