Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
chore(api): regenerated api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ovflowd committed Sep 12, 2022
1 parent 14fdb75 commit 2e3476f
Show file tree
Hide file tree
Showing 62 changed files with 7,156 additions and 7,226 deletions.
16 changes: 8 additions & 8 deletions content/api/v18/addons.en.md
Expand Up @@ -2,20 +2,20 @@
title: 'addons'
displayTitle: 'C++ addons'
category: 'api'
editPage: 'https://github.com/nodejs/node/blob/v18.8.0/doc/api/addons.md'
editPage: 'https://github.com/nodejs/node/blob/v18.9.0/doc/api/addons.md'
version: 'v18'
---

<Metadata version="v18.8.0" data={{"update":{"type":"introduced_in","version":["v0.10.0"]}}} />
<MC data={{"update":{"type":"introduced_in","version":["v0.10.0"]}}} />

<Metadata version="v18.8.0" data={{"type":"misc"}} />
<MC data={{"type":"misc"}} />

_Addons_ are dynamically-linked shared objects written in C++. The
[`require()`][require] function can load addons as ordinary Node.js modules.
Addons provide an interface between JavaScript and C/C++ libraries.

There are three options for implementing addons: Node-API, nan, or direct
use of internal V8, libuv and Node.js libraries. Unless there is a need for
use of internal V8, libuv, and Node.js libraries. Unless there is a need for
direct access to functionality which is not exposed by Node-API, use Node-API.
Refer to [C/C++ addons with Node-API](n-api.md) for more information on
Node-API.
Expand Down Expand Up @@ -46,7 +46,7 @@ involving knowledge of several components and APIs:

* Node.js includes other statically linked libraries including OpenSSL. These
other libraries are located in the `deps/` directory in the Node.js source
tree. Only the libuv, OpenSSL, V8 and zlib symbols are purposefully
tree. Only the libuv, OpenSSL, V8, and zlib symbols are purposefully
re-exported by Node.js and may be used to various extents by addons. See
[Linking to libraries included with Node.js][] for additional information.

Expand Down Expand Up @@ -242,7 +242,7 @@ NODE_MODULE_INIT(/* exports, module, context */) {
##### Worker support
<Metadata version="v18.8.0" data={{"changes":[{"version":["v14.8.0","v12.19.0"],"pr-url":"https://github.com/nodejs/node/pull/34572","description":"Cleanup hooks may now be asynchronous."}]}} />
<MC data={{"changes":[{"version":["v14.8.0","v12.19.0"],"pr-url":"https://github.com/nodejs/node/pull/34572","description":"Cleanup hooks may now be asynchronous."}]}} />
In order to be loaded from multiple Node.js environments,
such as a main thread and a Worker thread, an add-on needs to either:
Expand Down Expand Up @@ -392,7 +392,7 @@ try {

#### Linking to libraries included with Node.js

Node.js uses statically linked libraries such as V8, libuv and OpenSSL. All
Node.js uses statically linked libraries such as V8, libuv, and OpenSSL. All
addons are required to link to V8 and may link to any of the other dependencies
as well. Typically, this is as simple as including the appropriate
`#include <...>` statements (e.g. `#include <v8.h>`) and `node-gyp` will locate
Expand Down Expand Up @@ -441,7 +441,7 @@ illustration of how it can be used.

### Node-API

<Metadata version="v18.8.0" data={{"stability":{"level":2,"text":" - Stable"}}} />
<MC version="v18.9.0" data={{"stability":{"level":2,"text":" - Stable"}}} />

Node-API is an API for building native addons. It is independent from
the underlying JavaScript runtime (e.g. V8) and is maintained as part of
Expand Down
182 changes: 99 additions & 83 deletions content/api/v18/assert.en.md

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions content/api/v18/async_context.en.md
Expand Up @@ -2,15 +2,15 @@
title: 'async_context'
displayTitle: 'Asynchronous context tracking'
category: 'api'
editPage: 'https://github.com/nodejs/node/blob/v18.8.0/doc/api/async_context.md'
editPage: 'https://github.com/nodejs/node/blob/v18.9.0/doc/api/async_context.md'
version: 'v18'
---

<Metadata version="v18.8.0" data={{"update":{"type":"introduced_in","version":["v16.4.0"]}}} />
<MC data={{"update":{"type":"introduced_in","version":["v16.4.0"]}}} />

<Metadata version="v18.8.0" data={{"stability":{"level":2,"text":" - Stable"}}} />
<MC version="v18.9.0" data={{"stability":{"level":2,"text":" - Stable"}}} />

<Metadata version="v18.8.0" data={{"source_link":"lib/async_hooks.js"}} />
<MC data={{"source_link":"lib/async_hooks.js","version":"v18.9.0"}} />

### Introduction

Expand All @@ -31,9 +31,9 @@ import { AsyncLocalStorage, AsyncResource } from 'node:async_hooks';
const { AsyncLocalStorage, AsyncResource } = require('node:async_hooks');
```

### <DataTag tag="C" /> `AsyncLocalStorage`
### <Tag tag="C" /> `AsyncLocalStorage`

<Metadata version="v18.8.0" data={{"changes":[{"version":"v16.4.0","pr-url":"https://github.com/nodejs/node/pull/37675","description":"AsyncLocalStorage is now Stable. Previously, it had been Experimental."}],"update":{"type":"added","version":["v13.10.0","v12.17.0"]}}} />
<MC data={{"changes":[{"version":"v16.4.0","pr-url":"https://github.com/nodejs/node/pull/37675","description":"AsyncLocalStorage is now Stable. Previously, it had been Experimental."}],"update":{"type":"added","version":["v13.10.0","v12.17.0"]}}} />

This class creates stores that stay coherent through asynchronous operations.

Expand Down Expand Up @@ -114,18 +114,18 @@ Each instance of `AsyncLocalStorage` maintains an independent storage context.
Multiple instances can safely exist simultaneously without risk of interfering
with each other's data.

#### <DataTag tag="M" /> `new AsyncLocalStorage()`
#### <Tag tag="M" /> `new AsyncLocalStorage()`

<Metadata version="v18.8.0" data={{"update":{"type":"added","version":["v13.10.0","v12.17.0"]}}} />
<MC data={{"update":{"type":"added","version":["v13.10.0","v12.17.0"]}}} />

Creates a new instance of `AsyncLocalStorage`. Store is only provided within a
`run()` call or after an `enterWith()` call.

#### <DataTag tag="M" /> `asyncLocalStorage.disable()`
#### <Tag tag="M" /> `asyncLocalStorage.disable()`

<Metadata version="v18.8.0" data={{"update":{"type":"added","version":["v13.10.0","v12.17.0"]}}} />
<MC data={{"update":{"type":"added","version":["v13.10.0","v12.17.0"]}}} />

<Metadata version="v18.8.0" data={{"stability":{"level":1,"text":" - Experimental"}}} />
<MC version="v18.9.0" data={{"stability":{"level":1,"text":" - Experimental"}}} />

Disables the instance of `AsyncLocalStorage`. All subsequent calls
to `asyncLocalStorage.getStore()` will return `undefined` until
Expand All @@ -142,9 +142,9 @@ along with the corresponding async resources.
Use this method when the `asyncLocalStorage` is not in use anymore
in the current process.

#### <DataTag tag="M" /> `asyncLocalStorage.getStore()`
#### <Tag tag="M" /> `asyncLocalStorage.getStore()`

<Metadata version="v18.8.0" data={{"update":{"type":"added","version":["v13.10.0","v12.17.0"]}}} />
<MC data={{"update":{"type":"added","version":["v13.10.0","v12.17.0"]}}} />

* Returns: [`any`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types)

Expand All @@ -153,11 +153,11 @@ If called outside of an asynchronous context initialized by
calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it
returns `undefined`.

#### <DataTag tag="M" /> `asyncLocalStorage.enterWith(store)`
#### <Tag tag="M" /> `asyncLocalStorage.enterWith(store)`

<Metadata version="v18.8.0" data={{"update":{"type":"added","version":["v13.11.0","v12.17.0"]}}} />
<MC data={{"update":{"type":"added","version":["v13.11.0","v12.17.0"]}}} />

<Metadata version="v18.8.0" data={{"stability":{"level":1,"text":" - Experimental"}}} />
<MC version="v18.9.0" data={{"stability":{"level":1,"text":" - Experimental"}}} />

* `store` [`any`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types)

Expand Down Expand Up @@ -199,9 +199,9 @@ emitter.emit('my-event');
asyncLocalStorage.getStore(); // Returns the same object
```

#### <DataTag tag="M" /> `asyncLocalStorage.run(store, callback[, ...args])`
#### <Tag tag="M" /> `asyncLocalStorage.run(store, callback[, ...args])`

<Metadata version="v18.8.0" data={{"update":{"type":"added","version":["v13.10.0","v12.17.0"]}}} />
<MC data={{"update":{"type":"added","version":["v13.10.0","v12.17.0"]}}} />

* `store` [`any`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types)
* `callback` [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function)
Expand Down Expand Up @@ -235,11 +235,11 @@ try {
}
```

#### <DataTag tag="M" /> `asyncLocalStorage.exit(callback[, ...args])`
#### <Tag tag="M" /> `asyncLocalStorage.exit(callback[, ...args])`

<Metadata version="v18.8.0" data={{"update":{"type":"added","version":["v13.10.0","v12.17.0"]}}} />
<MC data={{"update":{"type":"added","version":["v13.10.0","v12.17.0"]}}} />

<Metadata version="v18.8.0" data={{"stability":{"level":1,"text":" - Experimental"}}} />
<MC version="v18.9.0" data={{"stability":{"level":1,"text":" - Experimental"}}} />

* `callback` [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function)
* `...args` [`any`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types)
Expand Down Expand Up @@ -304,9 +304,9 @@ of `asyncLocalStorage.getStore()` after the calls you suspect are responsible
for the loss. When the code logs `undefined`, the last callback called is
probably responsible for the context loss.

### <DataTag tag="C" /> `AsyncResource`
### <Tag tag="C" /> `AsyncResource`

<Metadata version="v18.8.0" data={{"changes":[{"version":"v16.4.0","pr-url":"https://github.com/nodejs/node/pull/37675","description":"AsyncResource is now Stable. Previously, it had been Experimental."}]}} />
<MC data={{"changes":[{"version":"v16.4.0","pr-url":"https://github.com/nodejs/node/pull/37675","description":"AsyncResource is now Stable. Previously, it had been Experimental."}]}} />

The class `AsyncResource` is designed to be extended by the embedder's async
resources. Using this, users can easily trigger the lifetime events of their
Expand Down Expand Up @@ -372,7 +372,7 @@ asyncResource.asyncId();
asyncResource.triggerAsyncId();
```

#### <DataTag tag="M" /> `new AsyncResource(type[, options])`
#### <Tag tag="M" /> `new AsyncResource(type[, options])`

* `type` [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The type of async event.
* `options` [`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
Expand Down Expand Up @@ -410,7 +410,7 @@ class DBQuery extends AsyncResource {

#### Static method: `AsyncResource.bind(fn[, type[, thisArg]])`

<Metadata version="v18.8.0" data={{"changes":[{"version":"v17.8.0","pr-url":"https://github.com/nodejs/node/pull/42177","description":"Changed the default when `thisArg` is undefined to use `this` from the caller."},{"version":"v16.0.0","pr-url":"https://github.com/nodejs/node/pull/36782","description":"Added optional thisArg."}],"update":{"type":"added","version":["v14.8.0","v12.19.0"]}}} />
<MC data={{"changes":[{"version":"v17.8.0","pr-url":"https://github.com/nodejs/node/pull/42177","description":"Changed the default when `thisArg` is undefined to use `this` from the caller."},{"version":"v16.0.0","pr-url":"https://github.com/nodejs/node/pull/36782","description":"Added optional thisArg."}],"update":{"type":"added","version":["v14.8.0","v12.19.0"]}}} />

* `fn` [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The function to bind to the current execution context.
* `type` [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional name to associate with the underlying
Expand All @@ -422,9 +422,9 @@ Binds the given function to the current execution context.
The returned function will have an `asyncResource` property referencing
the `AsyncResource` to which the function is bound.

#### <DataTag tag="M" /> `asyncResource.bind(fn[, thisArg])`
#### <Tag tag="M" /> `asyncResource.bind(fn[, thisArg])`

<Metadata version="v18.8.0" data={{"changes":[{"version":"v17.8.0","pr-url":"https://github.com/nodejs/node/pull/42177","description":"Changed the default when `thisArg` is undefined to use `this` from the caller."},{"version":"v16.0.0","pr-url":"https://github.com/nodejs/node/pull/36782","description":"Added optional thisArg."}],"update":{"type":"added","version":["v14.8.0","v12.19.0"]}}} />
<MC data={{"changes":[{"version":"v17.8.0","pr-url":"https://github.com/nodejs/node/pull/42177","description":"Changed the default when `thisArg` is undefined to use `this` from the caller."},{"version":"v16.0.0","pr-url":"https://github.com/nodejs/node/pull/36782","description":"Added optional thisArg."}],"update":{"type":"added","version":["v14.8.0","v12.19.0"]}}} />

* `fn` [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The function to bind to the current `AsyncResource`.
* `thisArg` [`any`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types)
Expand All @@ -434,9 +434,9 @@ Binds the given function to execute to this `AsyncResource`'s scope.
The returned function will have an `asyncResource` property referencing
the `AsyncResource` to which the function is bound.

#### <DataTag tag="M" /> `asyncResource.runInAsyncScope(fn[, thisArg, ...args])`
#### <Tag tag="M" /> `asyncResource.runInAsyncScope(fn[, thisArg, ...args])`

<Metadata version="v18.8.0" data={{"update":{"type":"added","version":["v9.6.0"]}}} />
<MC data={{"update":{"type":"added","version":["v9.6.0"]}}} />

* `fn` [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The function to call in the execution context of this async
resource.
Expand All @@ -448,7 +448,7 @@ of the async resource. This will establish the context, trigger the AsyncHooks
before callbacks, call the function, trigger the AsyncHooks after callbacks, and
then restore the original execution context.

#### <DataTag tag="M" /> `asyncResource.emitDestroy()`
#### <Tag tag="M" /> `asyncResource.emitDestroy()`

* Returns: [`AsyncResource`](/api/async_hooks#asyncresource) A reference to `asyncResource`.

Expand All @@ -457,11 +457,11 @@ be thrown if it is called more than once. This **must** be manually called. If
the resource is left to be collected by the GC then the `destroy` hooks will
never be called.

#### <DataTag tag="M" /> `asyncResource.asyncId()`
#### <Tag tag="M" /> `asyncResource.asyncId()`

* Returns: [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The unique `asyncId` assigned to the resource.

#### <DataTag tag="M" /> `asyncResource.triggerAsyncId()`
#### <Tag tag="M" /> `asyncResource.triggerAsyncId()`

* Returns: [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The same `triggerAsyncId` that is passed to the
`AsyncResource` constructor.
Expand Down

0 comments on commit 2e3476f

Please sign in to comment.