Socket
Book a DemoInstallSign in
Socket

jpubsub

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jpubsub

Simple PubSub

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

jpubsub - Simple Javascript PubSub

Install

yarn add jpubsub
# or
npm install -S jpubsub
import makePublisher from 'jpubsub'
import type {Subscriber} from 'jpubsub' // generic type Subscriber<T>
// or
const makePublisher = require('jpubsub')

// define a subscriber
const subscriber: Subscriber<string> = (data) => {
		console.log(data)
}
// create a publisher
const pubsliher = makePubsliher<string>()
// subscribe
const unsubscribe = publisher.subscribe(subscriber)
// publish
publisher.publish('hello')
// unsubscribe
unsubscribe()

FAQs

Package last updated on 18 Nov 2023

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