1
- declare module 'aurelia-event-aggregator' {
2
- import * as LogManager from 'aurelia-logging' ;
3
-
4
- /**
5
- * Represents a disposable subsciption to an EventAggregator event.
6
- */
7
- export interface Subscription {
8
-
1
+ /**
2
+ * Represents a disposable subsciption to an EventAggregator event.
3
+ */
4
+ export interface Subscription {
9
5
/**
10
- * Disposes the subscription.
11
- */
6
+ * Disposes the subscription.
7
+ */
12
8
dispose ( ) : void ;
13
- }
14
- class Handler {
15
- constructor ( messageType : any , callback : any ) ;
16
- handle ( message : any ) : any ;
17
- }
18
-
19
- /**
20
- * Enables loosely coupled publish/subscribe messaging.
21
- */
22
- export class EventAggregator {
23
-
9
+ }
10
+ /**
11
+ * Enables loosely coupled publish/subscribe messaging.
12
+ */
13
+ export declare class EventAggregator {
14
+ private eventLookup ;
15
+ private messageHandlers ;
24
16
/**
25
- * Creates an instance of the EventAggregator class .
26
- */
27
- constructor ( ) ;
28
-
17
+ * Publishes a message .
18
+ * @param event The event data type to publish to.
19
+ */
20
+ publish < T > ( event : T ) : void ;
29
21
/**
30
- * Publishes a message.
31
- * @param event The event or channel to publish to.
32
- * @param data The data to publish on the channel.
33
- */
34
- publish ( event : string | any , data ?: any ) : void ;
35
-
22
+ * Publishes a message.
23
+ * @param event The message channel to publish to.
24
+ * @param data The data to publish on the channel.
25
+ */
26
+ publish ( event : string , data ?: any ) : void ;
36
27
/**
37
- * Subscribes to a message channel or message type.
38
- * @param event The event channel or event data type.
39
- * @param callback The callback to be invoked when when the specified message is published.
40
- */
41
- subscribe ( event : string | Function , callback : Function ) : Subscription ;
42
-
28
+ * Subscribes to a message channel or message type.
29
+ * @param event The message data Type to subscribe to.
30
+ * @param callback The callback to be invoked when the specified message is published.
31
+ */
32
+ subscribe < T > ( event : Constructor < T > , callback : ( message : T ) => void ) : Subscription ;
43
33
/**
44
- * Subscribes to a message channel or message type, then disposes the subscription automatically after the first message is received.
45
- * @param event The event channel or event data type.
46
- * @param callback The callback to be invoked when when the specified message is published.
47
- */
48
- subscribeOnce ( event : string | Function , callback : Function ) : Subscription ;
49
- }
50
-
51
- /**
52
- * Includes EA functionality into an object instance.
53
- * @param obj The object to mix Event Aggregator functionality into.
54
- */
55
- export function includeEventsIn ( obj : Object ) : EventAggregator ;
56
-
57
- /**
58
- * Configures a global EA by merging functionality into the Aurelia instance.
59
- * @param config The Aurelia Framework configuration object used to configure the plugin.
60
- */
61
- export function configure ( config : Object ) : void ;
62
- }
34
+ * Subscribes to a message channel or message type.
35
+ * @param event The message channel to subscribe to.
36
+ * @param callback The callback to be invoked when the specified message is published.
37
+ */
38
+ subscribe ( event : string , callback : ( message : any , event ?: string ) => void ) : Subscription ;
39
+ /**
40
+ * Subscribes to a message type, then disposes the subscription automatically after the first message is received.
41
+ * @param event The message data Type to subscribe to.
42
+ * @param callback The callback to be invoked when when the specified message is published.
43
+ */
44
+ subscribeOnce < T > ( event : Constructor < T > , callback : ( message : T ) => void ) : Subscription ;
45
+ /**
46
+ * Subscribes to a message channel, then disposes the subscription automatically after the first message is received.
47
+ * @param event The message channel to subscribe to.
48
+ * @param callback The callback to be invoked when when the specified message is published.
49
+ */
50
+ subscribeOnce ( event : string , callback : ( message : any , event ?: string ) => void ) : Subscription ;
51
+ }
52
+ /**
53
+ * Includes EA functionality into an object instance.
54
+ * @param obj The object to mix Event Aggregator functionality into.
55
+ */
56
+ export declare function includeEventsIn ( obj : any ) : EventAggregator ;
57
+ /**
58
+ * Configures a global EA by merging functionality into the Aurelia instance.
59
+ * @param config The Aurelia Framework configuration object used to configure the plugin.
60
+ */
61
+ export declare function configure ( config : any ) : void ;
0 commit comments