* @param {AsyncLocalStorageOptions} [options]
(options = kEmptyObject)
| 46 | * @param {AsyncLocalStorageOptions} [options] |
| 47 | */ |
| 48 | constructor(options = kEmptyObject) { |
| 49 | this.kResourceStore = Symbol('kResourceStore'); |
| 50 | this.enabled = false; |
| 51 | validateObject(options, 'options'); |
| 52 | this.#defaultValue = options.defaultValue; |
| 53 | |
| 54 | if (options.name !== undefined) { |
| 55 | this.#name = `${options.name}`; |
| 56 | } |
| 57 | |
| 58 | this._enable(); |
| 59 | } |
| 60 | |
| 61 | /** @type {string} */ |
| 62 | get name() { return this.#name || ''; } |