This release is 1 version behind 1.0.12 — the latest version of @std/internal. Jump to latest
Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
INTERNAL: The internal package for @std. Do not use this directly.
This package works with Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun




JSR Score
100%
Published
6 months ago (1.0.10)
// Copyright 2018-2025 the Deno authors. MIT license. // partial `DisposableStack` polyfill // https://github.com/tc39/proposal-explicit-resource-management export function disposableStack() { return { disposables: [] as Disposable[], defer(fn: () => void) { this.disposables.push({ [Symbol.dispose]: fn }); }, use(val: Disposable) { this.disposables.push(val); }, [Symbol.dispose]() { for (let i = this.disposables.length - 1; i >= 0; --i) { this.disposables[i]![Symbol.dispose](); } }, }; }