Create a DisposableOne that manages a single Disposer or IDisposable.
A DisposableOne is also a Disposer, which means it can be the dispose method of an IDisposable.
dispose
import { type IDisposable, DisposableOne } from "@wopjs/disposable";const dispose = disposableOne();dispose.set(() => console.log("hello"));dispose.set(() => console.log("world")); // prints "hello"dispose.set(() => console.log("foo")); // prints "world"dispose(); // prints "foo"
A disposable store.
Optional
Create a DisposableOne that manages a single Disposer or IDisposable.
A DisposableOne is also a Disposer, which means it can be the
dispose
method of an IDisposable.Example
Returns
A disposable store.