src/vs/workbench/contrib/audioCues/browser/observable.ts/waitForState
export function waitForState<T>(observable: IObservable<T>, predicate: (state: T) => boolean): Promise<T> {
	return new Promise(resolve => {
		const d = autorun(reader => {
			const currentState = observable.read(reader);
			if (predicate(currentState)) {
				d.dispose();
				resolve(currentState);
			}
		}, 'waitForState');
	});
}