src/vs/workbench/contrib/audioCues/browser/observable.ts/debouncedObservable
export function debouncedObservable<T>(observable: IObservable<T>, debounceMs: number, disposableStore: DisposableStore): IObservable<T | undefined> {
	const debouncedObservable = new ObservableValue<T | undefined>(undefined, 'debounced');

	let timeout: any = undefined;

	disposableStore.add(autorun(reader => {
		const value = observable.read(reader);

		if (timeout) {
			clearTimeout(timeout);
		}
		timeout = setTimeout(() => {
			transaction(tx => {
				debouncedObservable.set(value, tx);
			});
		}, debounceMs);

	}, 'debounce'));

	return debouncedObservable;
}