We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa75dd8 commit efda2fdCopy full SHA for efda2fd
README.md
@@ -201,8 +201,12 @@ const asyncVar = new AsyncContext.Variable();
201
// Sets the current value to 'top', and executes the `main` function.
202
asyncVar.run("top", main);
203
204
-function main() {
205
- // AsyncContext.Variable is maintained through other platform queueing.
+async function main() {
+ // AsyncContext.Variable is propagated on async/await.
206
+ await Promise.resolve();
207
+ console.log(asyncVar.get()); // => 'top'
208
+
209
+ // AsyncContext.Variable is propagated through platform tasks.
210
setTimeout(() => {
211
console.log(asyncVar.get()); // => 'top'
212
0 commit comments