Enhance a Disposer so that it can be safely self-disposed.
If it is attached to a DisposableStore, it will be removed from the store automatically when self-disposed.
An abortable DisposableDisposer.
let timeoutId;const disposer = abortable(() => clearTimeout(timeoutId));timeoutId = setTimeout(() => console.log("hello"), 1000);// Add to a storeconst disposable = new DisposableStore();disposable.add(disposer);// Self-disposedisposer(); // setTimeout is cleared and the disposer is removed from the store.
A Disposer.
Enhance a Disposer so that it can be safely self-disposed.
If it is attached to a DisposableStore, it will be removed from the store automatically when self-disposed.
Returns
An abortable DisposableDisposer.
Example