@types/pubsub-js
Advanced tools
Comparing version 1.8.2 to 1.8.3
@@ -5,12 +5,13 @@ // Type definitions for PubSubJS 1.8.0 | ||
// Matthias Lindinger <https://github.com/morpheus-87> | ||
// Profesor08 <https://github.com/Profesor08> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
declare namespace PubSubJS { | ||
interface Base | ||
interface Base<T = any, M = Message> | ||
extends CountSubscriptions, | ||
ClearAllSubscriptions, | ||
GetSubscriptions, | ||
Publish, | ||
Subscribe, | ||
Unsubscribe { | ||
Publish<T, M>, | ||
Subscribe<T, M>, | ||
Unsubscribe<T> { | ||
name: string; | ||
@@ -20,28 +21,34 @@ version: string; | ||
type Token = string; | ||
type Message = string | symbol; | ||
type SubscriptionListener<T> = (message: string, data?: T) => void; | ||
interface CountSubscriptions { | ||
countSubscriptions(token: any): number; | ||
countSubscriptions(token: Token): number; | ||
} | ||
interface ClearAllSubscriptions { | ||
clearAllSubscriptions(token?: any): void; | ||
clearAllSubscriptions(token?: Token): void; | ||
} | ||
interface GetSubscriptions { | ||
getSubscriptions(token: any): any[]; | ||
getSubscriptions(token: Token): Message[]; | ||
} | ||
interface Publish { | ||
publish(message: string | Symbol, data?: any): boolean; | ||
interface Publish<T, M> { | ||
publish(message: M, data?: T): boolean; | ||
publishSync(message: string | Symbol, data?: any): boolean; | ||
publishSync(message: M, data?: T): boolean; | ||
} | ||
interface Subscribe { | ||
subscribe(message: string | Symbol, func: Function): string; | ||
interface Subscribe<T, M> { | ||
subscribe(message: M, func: SubscriptionListener<T>): Token; | ||
subscribeOnce(message: string | Symbol, func: Function): any; | ||
subscribeOnce(message: M, func: SubscriptionListener<T>): Base<T, M>; | ||
} | ||
interface Unsubscribe { | ||
unsubscribe(tokenOrFunction: any): any; | ||
interface Unsubscribe<T> { | ||
unsubscribe(tokenOrFunction: Token | SubscriptionListener<T>): Token | boolean; | ||
} | ||
@@ -48,0 +55,0 @@ } |
{ | ||
"name": "@types/pubsub-js", | ||
"version": "1.8.2", | ||
"version": "1.8.3", | ||
"description": "TypeScript definitions for PubSubJS", | ||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pubsub-js", | ||
"license": "MIT", | ||
@@ -16,2 +17,7 @@ "contributors": [ | ||
"githubUsername": "morpheus-87" | ||
}, | ||
{ | ||
"name": "Profesor08", | ||
"url": "https://github.com/Profesor08", | ||
"githubUsername": "Profesor08" | ||
} | ||
@@ -28,4 +34,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "15582274904aa0f3e8f37b594b9951c4f7330ef2e02f269c8cc01b1c38df9a1c", | ||
"typeScriptVersion": "3.4" | ||
"typesPublisherContentHash": "bfdca1f93836164330e9ace4d5da8173e85f046f4d043dee23a231db63ff2f53", | ||
"typeScriptVersion": "3.7" | ||
} |
@@ -9,5 +9,68 @@ # Installation | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pubsub-js. | ||
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pubsub-js/index.d.ts) | ||
````ts | ||
// Type definitions for PubSubJS 1.8.0 | ||
// Project: https://github.com/mroderick/PubSubJS | ||
// Definitions by: Boris Yankov <https://github.com/borisyankov> | ||
// Matthias Lindinger <https://github.com/morpheus-87> | ||
// Profesor08 <https://github.com/Profesor08> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
declare namespace PubSubJS { | ||
interface Base<T = any, M = Message> | ||
extends CountSubscriptions, | ||
ClearAllSubscriptions, | ||
GetSubscriptions, | ||
Publish<T, M>, | ||
Subscribe<T, M>, | ||
Unsubscribe<T> { | ||
name: string; | ||
version: string; | ||
} | ||
type Token = string; | ||
type Message = string | symbol; | ||
type SubscriptionListener<T> = (message: string, data?: T) => void; | ||
interface CountSubscriptions { | ||
countSubscriptions(token: Token): number; | ||
} | ||
interface ClearAllSubscriptions { | ||
clearAllSubscriptions(token?: Token): void; | ||
} | ||
interface GetSubscriptions { | ||
getSubscriptions(token: Token): Message[]; | ||
} | ||
interface Publish<T, M> { | ||
publish(message: M, data?: T): boolean; | ||
publishSync(message: M, data?: T): boolean; | ||
} | ||
interface Subscribe<T, M> { | ||
subscribe(message: M, func: SubscriptionListener<T>): Token; | ||
subscribeOnce(message: M, func: SubscriptionListener<T>): Base<T, M>; | ||
} | ||
interface Unsubscribe<T> { | ||
unsubscribe(tokenOrFunction: Token | SubscriptionListener<T>): Token | boolean; | ||
} | ||
} | ||
declare var PubSub: PubSubJS.Base; | ||
declare module 'pubsub-js' { | ||
export = PubSub; | ||
} | ||
```` | ||
### Additional Details | ||
* Last updated: Thu, 14 Jan 2021 20:56:31 GMT | ||
* Last updated: Thu, 23 Sep 2021 21:01:23 GMT | ||
* Dependencies: none | ||
@@ -17,2 +80,2 @@ * Global values: `PubSub` | ||
# Credits | ||
These definitions were written by [Boris Yankov](https://github.com/borisyankov), and [Matthias Lindinger](https://github.com/morpheus-87). | ||
These definitions were written by [Boris Yankov](https://github.com/borisyankov), [Matthias Lindinger](https://github.com/morpheus-87), and [Profesor08](https://github.com/Profesor08). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
6225
45
0
80