mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
PR-URL: https://github.com/nodejs/node/pull/60150 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
14 lines
407 B
JavaScript
14 lines
407 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const { AsyncLocalStorage } = require('async_hooks');
|
|
|
|
const asyncLocalStorage = new AsyncLocalStorage();
|
|
|
|
asyncLocalStorage.run({}, common.mustCall((runArg) => {
|
|
assert.strictEqual(runArg, 'foo');
|
|
asyncLocalStorage.exit(common.mustCall((exitArg) => {
|
|
assert.strictEqual(exitArg, 'bar');
|
|
}), 'bar');
|
|
}), 'foo');
|