tiny-pubsub
v1.1.0
Published
a tiny event handling library with no dependencies
Downloads
70
Readme
tiny-pubsub
tiny-pubsub is a super simple event management package written in javascript with no dependencies.
You don't need a framework
Right now tiny-pubsub is 854 bytes.
It handles most of the UI interactions for my game bulletz.io.
I wholeheartedly believe my game is more performant and simple due to the lack of framework.
Installation
npm install --save tiny-pubsub
Usage
The api only has three functions. publish
, subscribe
, and unsubscribe
.
const {subscribe, publish, unsubscribe} = require('tiny-pubsub')
let logJoin = (name) => console.log(`${name} has joined the room!`);
subscribe("chatroom-join", logJoin)
publish("chatroom-join", "Luke")
// > Luke has joined the room!
unsubscribe(logJoin)
publish("chatroom-join", "Luke")
// nothing will print
Contributing
Send pull requests.
Testing
npm install --dev
npm run test
License
MIT License.