diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 8080e628617bde..a812f6998457f3 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -733,6 +733,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])`