Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

publisher-subscriber-pattern

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

publisher-subscriber-pattern - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

4

CHANGELOG.MD

@@ -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

2

dist/_types.d.ts
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,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc