Skip to content

Instantly share code, notes, and snippets.

@ZeevKatz
Last active August 31, 2020 09:05
Show Gist options
  • Save ZeevKatz/a7f8dd93f17d7f72b4b327a0cbdef57e to your computer and use it in GitHub Desktop.
Save ZeevKatz/a7f8dd93f17d7f72b4b327a0cbdef57e to your computer and use it in GitHub Desktop.
private readonly onChanges$$ = new Subject();
private readonly onChanges$ = this.onChanges$$.pipe();
ngOnChanges({ events }: SimpleChanges) {
this.onChanges$$.next();
if (events) {
this.registerEvents(this.events)
.pipe(
takeUntil(this.onChanges$),
untilDestroyed(this)
)
.subscribe(event => this.logEvent(event, this.properties));
}
}
ngOnDestroy() {
this.onChanges$$.complete();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment