1.0.1 • Published 6 years ago
bbus v1.0.1
Bbus
Event Message Bus
How to use
// main.js
import { default as bbus } from 'bbus'
bbus.on('SAY_SOMETHING', (message) => { console.log(message) })
// calls.js
import { default as bbus } from 'bbus'
bbus.emit('SAY_SOMETHING', 'Hello, world!')
Unsubscribe
// main.js
import { default as bbus } from 'bbus'
bbus.off('SAY_SOMETHING', *reference_for_function*)
ES5
You can use require() syntax too:
// main.js
const bbus = require('./bbus.js');
bbus.on('SAY_SOMETHING', (message) => { console.log(message) })