DisposableStack() constructor
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
The DisposableStack() constructor creates DisposableStack objects.
Syntax
js
new DisposableStack()
Parameters
None.
Return value
A new DisposableStack object.
Examples
Creating a DisposableStack
js
const disposer = new DisposableStack();
disposer.defer(() => console.log("Disposed!"));
disposer.dispose();
// Logs: Disposed!
Specifications
| Specification |
|---|
| ECMAScript Async Explicit Resource Management # sec-disposablestack-constructor |
Browser compatibility
| desktop | mobile | server | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DisposableStack
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support