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

publisher-subscriber-react-hoc

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

publisher-subscriber-react-hoc

React Higher-Order Component, which provides 'subscribe', 'unsubscribeAll', 'eventSubscribersCount', 'subscribersCount' methods. Can be used with various eventEmitters, including browser's 'window' object.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

About

  • Javascript implementation of publisher subscriber pattern for React (Higher-order-component)
  • Can be used with various event emitters including browser's window object
  • Provides ProviderPublisher and withPublisher

Installation

npm i publisher-subscriber-react-hoc

API

PublisherProvider

interface PublisherProviderProps {
  emitter: Record<string | number | symbol, unknown>;;
  addListenerMethodName: string;
  removeListenerMethodName: string;
};

withPublisher

type EventCallback<P = {}> = (event: P & Event) => void;

interface WithPublisherProps {
  eventSubscribersCount(eventName: string): number;
  subscribe(eventName: string, eventCallback: EventCallback): () => void;
  subscribersCount(): number;
  unsubscribeAll(): void;
};

Dependencies

Dependencies

  • publisher-subscriber-pattern@2.0.2
  • react@16.x.x
  • react-dom@16.x.x

DevDependencies

  • Typescript
  • jest, enzyme
  • Babel

Keywords

FAQs

Package last updated on 09 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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