DisposableStack() constructor
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Constructor DisposableStack() tạo các đối tượng DisposableStack.
Cú pháp
js
new DisposableStack()
Tham số
Không có.
Giá trị trả về
Một đối tượng DisposableStack mới.
Ví dụ
>Tạo một DisposableStack
js
const disposer = new DisposableStack();
disposer.defer(() => console.log("Disposed!"));
disposer.dispose();
// Logs: Disposed!
Đặc tả
| Specification |
|---|
| ECMAScript Async Explicit Resource Management> # sec-disposablestack-constructor> |