Skip to content

Instantly share code, notes, and snippets.

@bob-lee
Created November 2, 2018 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bob-lee/83233b2be7bcf7d433a66c4f8124ad78 to your computer and use it in GitHub Desktop.
Save bob-lee/83233b2be7bcf7d433a66c4f8124ad78 to your computer and use it in GitHub Desktop.
export class LazyLoadService {
delayMsec = 0;
// announce order to [lazyLoad] directives
private order$ = new Subject<string>();
announcedOrder = this.order$.asObservable();
announceOrder(name: string) {
this.order$.next(name);
}
registerAfter(msec: number) {
if (msec > 0) {
this.delayMsec = msec;
setTimeout(_ => this.announceOrder('register'), msec);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment