cuspin
v1.0.9
Published
Cuspin - Minimal Event Manager
Downloads
12
Readme
cuspin
Minimal JavaScript Event Manager
Install
npm install cuspin
Usage
import { subscribe, subscribeOnce, emit } from 'cuspin';
// subscribe to an event
subscribe('example', (args) => {
console.log(args)
})
// subscribe once to an event
subscribeOnce('example', (args) => {
console.log(args);
})
// emit event
emit('example', 'Hello world!');
emit('example', { message: 'Hello world!' });
emit('example', ['Hello', 'world!']);