Skip to content

Instantly share code, notes, and snippets.

@ZeevKatz
Last active September 1, 2020 12:55
Show Gist options
  • Save ZeevKatz/c975e9e92c250e52172c084eb35e6098 to your computer and use it in GitHub Desktop.
Save ZeevKatz/c975e9e92c250e52172c084eb35e6098 to your computer and use it in GitHub Desktop.
private registeredEventsSubscription: Subscription;
ngOnChanges({ events }: SimpleChanges) {
if (events) {
this.unsubscribeRegisteredEvents();
this.registeredEventsSubscription = this.registerEvents(this.events)
.pipe(untilDestroyed(this))
.subscribe(event => this.logEvent(event, this.properties));
}
}
unsubscribeRegisteredEvents() {
if (this.registeredEventsSubscription) {
this.registeredEventsSubscription.unsubscribe();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment