ConstAn abortable DisposableDisposer.
let timeoutId;
const disposer = abortable(() => clearTimeout(timeoutId));
timeoutId = setTimeout(() => console.log("hello"), 1000);
// Add to a store
const disposable = new DisposableStore();
disposable.add(disposer);
// Self-dispose
disposer(); // setTimeout is cleared and the disposer is removed from the store.
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.