Last active
September 1, 2020 12:55
-
-
Save ZeevKatz/c975e9e92c250e52172c084eb35e6098 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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