rxjs/operators#auditTime TypeScript Examples
The following examples show how to use
rxjs/operators#auditTime.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: mouse-move-event-dispatcher.ts From scion-microfrontend-platform with Eclipse Public License 2.0 | 6 votes |
/**
* Produces synth events from native 'mousemove' events and publishes them on the message bus.
* It allows event dispatchers in other documents to consume these events and publish them on the document's event bus.
*/
private produceSynthEvents(): void {
fromEvent<MouseEvent>(document, 'mousemove')
.pipe(
filter(event => event.buttons === PRIMARY_MOUSE_BUTTON),
auditTime(20),
takeUntil(this._destroy$),
)
.subscribe((event: MouseEvent) => {
const options = {headers: new Map().set(DISPATCHER_ID_HEADER, this._dispatcherId)};
Beans.get(MessageClient).publish(MOUSEMOVE_EVENT_TOPIC, [event.screenX, event.screenY], options);
});
}
Example #2
Source File: BindQueryParamsManager.ts From bind-query-params with MIT License | 6 votes |
onInit() {
this.handleInitialURLSync();
this.updateControl(
this.defs,
{ emitEvent: true },
(def) => !!(def.syncInitialQueryParamValue ?? this.createOptions?.syncInitialQueryParamValue)
);
const controls = this.defs.map((def) => {
return this.group.get(def.path)!.valueChanges.pipe(
map((value) => ({
def,
value,
}))
);
});
// Could be a several changes in the same tick,
// for example when we use reset() or patchValue.
// We need to aggregate the changes and apply them once
// because the router navigates in micro task
let buffer: ResolveParamsOption[] = [];
merge(...controls)
.pipe(
map((result) => buffer.push(result)),
auditTime(0),
takeUntil(this.$destroy)
)
.subscribe(() => {
this.updateQueryParams(resolveParams(buffer));
buffer = [];
});
}
Example #3
Source File: gantt-dom.service.ts From ngx-gantt with MIT License | 5 votes |
getResize(): Observable<Event> {
return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
}