Skip to main content
AsyncLocalStorage.prototype.disable - async_hooks - Node documentation
method AsyncLocalStorage.prototype.disable
Unstable

Usage in Deno

import { AsyncLocalStorage } from "node:async_hooks";
AsyncLocalStorage.prototype.disable(): void

Disables the instance of AsyncLocalStorage. All subsequent calls to asyncLocalStorage.getStore() will return undefined until asyncLocalStorage.run() or asyncLocalStorage.enterWith() is called again.

When calling asyncLocalStorage.disable(), all current contexts linked to the instance will be exited.

Calling asyncLocalStorage.disable() is required before the asyncLocalStorage can be garbage collected. This does not apply to stores provided by the asyncLocalStorage, as those objects are garbage collected along with the corresponding async resources.

Use this method when the asyncLocalStorage is not in use anymore in the current process.

Return Type

void
Back to top