mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 15:03:07 +00:00
20 lines
519 B
TypeScript
20 lines
519 B
TypeScript
import { SchedulerLike, Subscription } from 'rxjs';
|
|
import { NgZone } from '@angular/core';
|
|
|
|
/**
|
|
* An RXJS scheduler that will re-enter the Angular zone to run what's scheduled
|
|
*/
|
|
export class EnterZoneScheduler implements SchedulerLike {
|
|
constructor(private zone: NgZone, private scheduler: SchedulerLike) { }
|
|
|
|
schedule(...args: any[]): Subscription {
|
|
return this.zone.run(() =>
|
|
this.scheduler.schedule.apply(this.scheduler, args)
|
|
);
|
|
}
|
|
|
|
now (): number {
|
|
return this.scheduler.now();
|
|
}
|
|
}
|