function disposableTimeout(handler, timeout = 0, store) {
    const timer = setTimeout(() => {
        handler();
        if (store) {
            disposable.dispose();
        }
    }, timeout);
    const disposable = toDisposable(() => {
        clearTimeout(timer);
        store === null || store === void 0 ? void 0 : store.deleteAndLeak(disposable);
    });
    store === null || store === void 0 ? void 0 : store.add(disposable);
    return disposable;
}
Creates a timeout that can be disposed using its returned value.
@param handler The timeout handler.
@param timeout An optional timeout in milliseconds.
@param store An optional {@link DisposableStore} that will have the timeout disposable managed automatically.

@example
const store = new DisposableStore;
// Call the timeout after 1000ms at which point it will be automatically
// evicted from the store.
const timeoutDisposable = disposableTimeout(() => {}, 1000, store);

if (foo) {
  // Cancel the timeout and evict it from store.
  timeoutDisposable.dispose();
}