File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ import { autoinject , transient } from 'aurelia-framework' ;
2+ import { EventAggregator , Subscription } from 'aurelia-event-aggregator' ;
3+
4+ export class EventBusEvents {
5+ public static IDS = {
6+ i18n : {
7+ locale : {
8+ changed : 'i18n:locale:changed'
9+ }
10+ }
11+ } ;
12+ }
13+
14+ @transient ( )
15+ @autoinject
16+ export class EventBusService {
17+
18+ private disposables : Subscription [ ] = [ ] ;
19+
20+ constructor (
21+ public eventAggregator : EventAggregator
22+ ) { }
23+
24+ public addSubscription ( eventId : string , callback : Function ) : EventBusService {
25+ this . disposables . push ( this . eventAggregator . subscribe ( eventId , callback ) ) ;
26+ return this ;
27+ }
28+
29+ public dispose ( ) : void {
30+ this . disposables . forEach ( d => d . dispose ( ) ) ;
31+ }
32+
33+ }
You can’t perform that action at this time.
0 commit comments