mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-20 12:00:53 +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();
|
||||
}
|
||||
Vendored
+11
-2
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user