diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index f980b237b11c6e..ebab01f6f79ed4 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -729,6 +729,32 @@ class DBQuery extends AsyncResource { } ``` +#### `static AsyncResource.bind(fn[, type])` + + +* `fn` {Function} The function to bind to the current execution context. +* `type` {string} An optional name to associate with the underlying + `AsyncResource`. + +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. + +#### `asyncResource.bind(fn)` + + +* `fn` {Function} The function to bind to the current `AsyncResource`. + +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. + #### `asyncResource.runInAsyncScope(fn[, thisArg, ...args])`