Vheissu / aurelia-for-real-world-web-applications-book-feedback

Post feedback as issues here on Github for the Aurelia book. Be as descriptive and honest as you like.
15 stars 0 forks source link

Dispose of Subscriptions #118

Closed boshinski closed 7 years ago

boshinski commented 7 years ago

In your chapter on the EventAggregator, you might want to dispose of the subscriptions in the detached method. At least that is what I picked up in a tutorial by Rob Eisenberg. So maybe something like:


attached() {
    this.subscribe1 = this.ea.subscribe('custom-element-loaded', obj => {
     console.log(obj.myProp);
     console.log(obj.anotherProp);
   });
}
detached() {
   this.subscribe1.dispose();
}
Vheissu commented 7 years ago

Sorry for the delay on this one, been focusing on new content and less-so on fixes. This is going out probably tonight.