publisher-subscriber-pattern
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -0,1 +1,5 @@ | ||
# @2.0.2 [author: Katarzyna Ziomek-Zdanowicz, date: 2019.09.08] | ||
* converts EventCallback to generic type so type React.Events can be used | ||
* exports EmitterInstance type | ||
# @2.0.1 [author: Katarzyna Ziomek-Zdanowicz, date: 2019.09.08] | ||
@@ -2,0 +6,0 @@ * accepts 'string', 'number' and 'symbol' as types of keys in EmitterInstance, thus window will be valid emitterInstance |
import { Subscriber } from './subscriber'; | ||
export declare type EventCallback = (event: Event) => void; | ||
export declare type EventCallback<P = {}> = (event: P & Event) => void; | ||
export declare type EventName = string; | ||
@@ -4,0 +4,0 @@ export declare type EventData = [EventCallback, Subscriber[]]; |
@@ -10,2 +10,3 @@ "use strict"; | ||
// generic type so type React.Events can be used | ||
var isValidEmitter = function isValidEmitter(emitterInstance, addListenerMethodName, removeListenerMethodName) { | ||
@@ -12,0 +13,0 @@ var isOfType = function isOfType(value, type) { |
export { Publisher } from './publisher'; | ||
export { EventCallback, PublisherProps, UnsubscribeFunction, } from './_types'; | ||
export { EmitterInstance, EventCallback, PublisherProps, UnsubscribeFunction, } from './_types'; |
@@ -12,2 +12,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "EmitterInstance", { | ||
enumerable: true, | ||
get: function get() { | ||
return _types.EmitterInstance; | ||
} | ||
}); | ||
Object.defineProperty(exports, "EventCallback", { | ||
@@ -14,0 +20,0 @@ enumerable: true, |
@@ -7,3 +7,3 @@ import { EventCallback, PublisherProps } from './_types'; | ||
constructor(...args: PublisherProps); | ||
subscribe: (eventName: string, eventCallback: EventCallback, subscriberInstance?: Record<string | number | symbol, unknown> | undefined) => () => void; | ||
subscribe: (eventName: string, eventCallback: EventCallback<{}>, subscriberInstance?: Record<string | number | symbol, unknown> | undefined) => () => void; | ||
unsubscribeAll: () => void; | ||
@@ -10,0 +10,0 @@ eventSubscribersCount: (eventName: string) => number; |
{ | ||
"name": "publisher-subscriber-pattern", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Publisher subscriber pattern that can be used with different event emitters including browser window", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
import { Subscriber } from './subscriber'; | ||
export type EventCallback = (event: Event) => void; | ||
// generic type so type React.Events can be used | ||
export type EventCallback<P = {}> = (event: P & Event) => void; | ||
@@ -5,0 +6,0 @@ export type EventName = string; |
export { Publisher } from './publisher'; | ||
export { | ||
EmitterInstance, | ||
EventCallback, | ||
@@ -4,0 +5,0 @@ PublisherProps, |
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
30058
596