14 lines
358 B
JavaScript
14 lines
358 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const { AsyncLocalStorage } = require('async_hooks');
|
|
|
|
const asyncLocalStorage = new AsyncLocalStorage();
|
|
|
|
asyncLocalStorage.run({}, (runArg) => {
|
|
assert.strictEqual(runArg, 'foo');
|
|
asyncLocalStorage.exit((exitArg) => {
|
|
assert.strictEqual(exitArg, 'bar');
|
|
}, 'bar');
|
|
}, 'foo');
|