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>
16 lines
483 B
JavaScript
16 lines
483 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const { AsyncLocalStorage } = require('async_hooks');
|
|
|
|
const asyncLocalStorage = new AsyncLocalStorage();
|
|
|
|
asyncLocalStorage.run('hello node', common.mustCall(() => {
|
|
assert.strictEqual(asyncLocalStorage.getStore(), 'hello node');
|
|
}));
|
|
|
|
const runStore = { hello: 'node' };
|
|
asyncLocalStorage.run(runStore, common.mustCall(() => {
|
|
assert.strictEqual(asyncLocalStorage.getStore(), runStore);
|
|
}));
|