Update pubsubjs to latest version, and add exported module name

This commit is contained in:
Jeremy Scheff
2015-09-18 18:33:11 -04:00
parent 6f6e5c7dd9
commit fc2078411b
2 changed files with 23 additions and 2 deletions
+12
View File
@@ -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();
}
+11 -2
View File
@@ -1,10 +1,10 @@
// Type definitions for PubSubJS 1.3.5
// Type definitions for PubSubJS 1.5.2
// Project: https://github.com/mroderick/PubSubJS
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module PubSubJS {
interface Base extends Publish, Subscribe, Unsubscribe {
interface Base extends Publish, Subscribe, Unsubscribe, ClearAllSubscriptions {
version: string;
name: string;
}
@@ -25,6 +25,15 @@ declare module PubSubJS {
interface Unsubscribe{
unsubscribe(tokenOrFunction: any): any;
}
interface ClearAllSubscriptions{
clearAllSubscriptions(): any;
}
}
declare var PubSub: PubSubJS.Base;
declare module "pubsub-js" {
export = PubSub;
}