Skip to content

Commit

Permalink
document async hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
petkaantonov committed May 25, 2019
1 parent 8d9afb7 commit 8120177
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions docs/docs/api/promise.config.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ Promise.config(Object {
warnings: boolean=false,
longStackTraces: boolean=false,
cancellation: boolean=false,
monitoring: boolean=false
monitoring: boolean=false,
asyncHooks: boolean=false
} options) -> Object;
```

Configure long stack traces, warnings, monitoring and cancellation. Note that even though `false` is the default here, a development environment might be detected which automatically enables long stack traces and warnings. For **webpack** and **browserify** *development* environment is *always* enabled. See [installation](/docs/install.html#browserify-and-webpack) on how to configure webpack and browserify for production.
Configure long stack traces, warnings, monitoring, [async hooks](https://nodejs.org/api/async_hooks.html) and cancellation. Note that even though `false` is the default here, a development environment might be detected which automatically enables long stack traces and warnings. For **webpack** and **browserify** *development* environment is *always* enabled. See [installation](/docs/install.html#browserify-and-webpack) on how to configure webpack and browserify for production.

```js
Promise.config({
Expand All @@ -29,7 +30,9 @@ Promise.config({
// Enable cancellation
cancellation: true,
// Enable monitoring
monitoring: true
monitoring: true,
// Enable async hooks
asyncHooks: true,
});
```

Expand Down Expand Up @@ -67,6 +70,10 @@ NODE_ENV=development BLUEBIRD_WARNINGS=0 node app.js

Cancellation is always configured separately per bluebird instance.

# Async hooks

Bluebird supports [async hooks](https://nodejs.org/api/async_hooks.html) in node versions 9.6.0 and later. After it is enabled promises from the bluebird instance track async hook context.

</markdown></div>

<div id="disqus_thread"></div>
Expand Down

0 comments on commit 8120177

Please sign in to comment.