@uptimeventures/beam
v1.0.0
Published
A micro event emitter.
Downloads
5
Readme
Beam :satellite:
A micro event emitter, smaller than 500k when gzip'd.
Installation
npm install @uptimeventures/beam
Usage
Beam provides essentially the same interface as it's larger Node.js cousin:
import Beam from 'beam'
const emitter = new Beam()
beam.once('message', () => {
console.log('only tell me about this once')
})
beam.on('alert', (msg) => {
alert(msg)
})
beam.on('message', ({ name, email }) => {
console.log(`Hey, ${name}. You have a new message from ${email}.`)
})
beam.emit('alert', 'Something went wrong')
beam.emit('message', { name: 'Nicholas', email: '[email protected]' })
License
© 2017 Uptime Ventures, Ltd. All rights reserved. Released under the 3-Clause BSD License.