Skip to content
This repository has been archived by the owner on Aug 31, 2018. It is now read-only.

Commit

Permalink
doc: add documentation for workers module
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
addaleax authored and TimothyGu committed Sep 20, 2017
1 parent 6c35270 commit ef85bd3
Show file tree
Hide file tree
Showing 6 changed files with 513 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/api/_toc.md
Expand Up @@ -50,6 +50,7 @@
* [Utilities](util.html)
* [V8](v8.html)
* [VM](vm.html)
* [Worker](worker.html)
* [ZLIB](zlib.html)

<div class="line"></div>
Expand Down
3 changes: 3 additions & 0 deletions doc/api/domain.md
Expand Up @@ -25,6 +25,8 @@ will be notified, rather than losing the context of the error in the
`process.on('uncaughtException')` handler, or causing the program to
exit immediately with an error code.

*Note*: This module is not available in [`Worker`][]s.

## Warning: Don't Ignore Errors!

<!-- type=misc -->
Expand Down Expand Up @@ -505,3 +507,4 @@ rejections.
[`setInterval()`]: timers.html#timers_setinterval_callback_delay_args
[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_args
[`throw`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw
[`Worker`]: #worker_class_worker
27 changes: 27 additions & 0 deletions doc/api/process.md
Expand Up @@ -412,6 +412,8 @@ added: v0.7.0
The `process.abort()` method causes the Node.js process to exit immediately and
generate a core file.

*Note*: This feature is not available in [`Worker`][] threads.

## process.arch
<!-- YAML
added: v0.5.0
Expand Down Expand Up @@ -515,6 +517,8 @@ try {
}
```

*Note*: This feature is not available in [`Worker`][] threads.

## process.config
<!-- YAML
added: v0.7.7
Expand Down Expand Up @@ -901,6 +905,8 @@ console.log(process.env.test);
// => 1
```

*Note*: `process.env` is read-only in [`Worker`][] threads.

## process.execArgv
<!-- YAML
added: v0.7.7
Expand Down Expand Up @@ -1018,6 +1024,9 @@ If it is necessary to terminate the Node.js process due to an error condition,
throwing an *uncaught* error and allowing the process to terminate accordingly
is safer than calling `process.exit()`.

*Note*: in [`Worker`][] threads, this function stops the current thread rather than
the current process.

## process.exitCode
<!-- YAML
added: v0.11.8
Expand Down Expand Up @@ -1185,6 +1194,8 @@ console.log(process.getgroups()); // [ 27, 30, 46, 1000 ]
*Note*: This function is only available on POSIX platforms (i.e. not Windows
or Android).

*Note*: This feature is not available in [`Worker`][] threads.

## process.kill(pid[, signal])
<!-- YAML
added: v0.0.6
Expand Down Expand Up @@ -1502,6 +1513,7 @@ if (process.getegid && process.setegid) {
*Note*: This function is only available on POSIX platforms (i.e. not Windows
or Android).

*Note*: This feature is not available in [`Worker`][] threads.

## process.seteuid(id)
<!-- YAML
Expand Down Expand Up @@ -1530,6 +1542,8 @@ if (process.geteuid && process.seteuid) {
*Note*: This function is only available on POSIX platforms (i.e. not Windows
or Android).

*Note*: This feature is not available in [`Worker`][] threads.

## process.setgid(id)
<!-- YAML
added: v0.1.31
Expand Down Expand Up @@ -1557,6 +1571,8 @@ if (process.getgid && process.setgid) {
*Note*: This function is only available on POSIX platforms (i.e. not Windows
or Android).

*Note*: This feature is not available in [`Worker`][] threads.

## process.setgroups(groups)
<!-- YAML
added: v0.9.4
Expand All @@ -1573,6 +1589,8 @@ The `groups` array can contain numeric group IDs, group names or both.
*Note*: This function is only available on POSIX platforms (i.e. not Windows
or Android).

*Note*: This feature is not available in [`Worker`][] threads.

## process.setuid(id)
<!-- YAML
added: v0.1.28
Expand All @@ -1598,6 +1616,8 @@ if (process.getuid && process.setuid) {
*Note*: This function is only available on POSIX platforms (i.e. not Windows
or Android).

*Note*: This feature is not available in [`Worker`][] threads.


## process.stderr

Expand All @@ -1611,6 +1631,8 @@ a [Writable][] stream.
*Note*: `process.stderr` differs from other Node.js streams in important ways,
see [note on process I/O][] for more information.

*Note*: This feature is not available in [`Worker`][] threads.

## process.stdin

* {Stream}
Expand Down Expand Up @@ -1645,6 +1667,8 @@ For more information see [Stream compatibility][].
must call `process.stdin.resume()` to read from it. Note also that calling
`process.stdin.resume()` itself would switch stream to "old" mode.

*Note*: This feature is not available in [`Worker`][] threads.

## process.stdout

* {Stream}
Expand All @@ -1663,6 +1687,8 @@ process.stdin.pipe(process.stdout);
*Note*: `process.stdout` differs from other Node.js streams in important ways,
see [note on process I/O][] for more information.

*Note*: This feature is not available in [`Worker`][] threads.

### A note on process I/O

`process.stdout` and `process.stderr` differ from other Node.js streams in
Expand Down Expand Up @@ -1894,6 +1920,7 @@ cases:
[`require.main`]: modules.html#modules_accessing_the_main_module
[`require.resolve()`]: globals.html#globals_require_resolve
[`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_args
[`Worker`]: worker.html#worker_worker
[Child Process]: child_process.html
[Cluster]: cluster.html
[Duplex]: stream.html#stream_duplex_and_transform_streams
Expand Down
21 changes: 21 additions & 0 deletions doc/api/vm.md
Expand Up @@ -310,6 +310,27 @@ console.log(util.inspect(sandbox));
// { globalVar: 1024 }
```

## vm.moveMessagePortToContext(port, contextifiedSandbox)
<!-- YAML
added: REPLACEME
-->

* `port` {MessagePort}
* `contextifiedSandbox` {Object} A contextified object as returned by the
`vm.createContext()` method.
* Returns: {MessagePort}

Bind a `MessagePort` to a specific VM context. This returns a new `MessagePort`
object, whose prototype and methods act as if they were created in the passed
context. The received messages will also be emitted as objects from the passed
context.

Note that the return instance is *not* an `EventEmitter`; for receiving
messages, the `.onmessage` property can be used.

The `port` object on which this method was called can not be used for sending
or receiving further messages.

## vm.runInDebugContext(code)
<!-- YAML
added: v0.11.14
Expand Down

0 comments on commit ef85bd3

Please sign in to comment.