Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function throttleGet(time: number, getter: () => T): T {
if(tcache.has(getter)) {
return tcache.get(getter)!.current;
}
const ob = Rx.Observable.from(mu.toStream(getter));
const ob2 = ob.debounceTime(time); //.merge(ob.delay(time).sampleTime(time));
const v = mu.fromStream(ob2, mobx.untracked(getter));
tcache.set(getter, v);
return v.current;
}