Ember Subs Now
@action updatePrice(data) this.currentPrice = data.price;
// Unsubscribe (important!) this.eventBus.off('data-updated', this, this.handleUpdate); ember subs
⚠️ Use sparingly – overuse makes data flow hard to trace. | Pitfall | Fix | |---------|-----| | Forgetting to unsubscribe | Always call disconnect() or .off() in willDestroy | | Memory leaks | Check that references to components/services are cleared | | Stale data | Verify subscription updates tracked properties correctly | | Multiple subscriptions | Use a single service as the source of truth | @action updatePrice(data) this
disconnect() this.socket?.close();
// Subscribe this.eventBus.on('data-updated', this, this.handleUpdate); @action updatePrice(data) this.currentPrice = data.price