mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-11 11:50:54 +08:00
Update pubsubjs to latest version, and add exported module name
This commit is contained in:
@@ -68,4 +68,16 @@ function test_Hierarchical_addressing() {
|
||||
// topics, three times in total
|
||||
// But, mySpecificSubscriber will only be called once, as it only
|
||||
// subscribes to the 'car.drive' topic
|
||||
}
|
||||
|
||||
function ClearAllSubscriptions() {
|
||||
// create a function to receive messages
|
||||
var mySubscriber = (msg: string, data: any) => { console.log(msg, data); }
|
||||
|
||||
// create two subscriptions
|
||||
PubSub.subscribe('topic1', mySubscriber);
|
||||
PubSub.subscribe('topic2', mySubscriber);
|
||||
|
||||
// unsubscribe from all subscrpitions
|
||||
PubSub.clearAllSubscriptions();
|
||||
}
|
||||
Reference in New Issue
Block a user