0.0.4 • Published 6 months ago

jpubsub v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

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()
0.0.3

6 months ago

0.0.4

6 months ago

0.0.2

9 months ago

0.0.1

9 months ago