1.1.0 • Published 7 years ago

basic-events v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

basic-events

A very basic event emitter with three methods: .on, .once and .emit.

usage

import events from 'basic-events'

const app = {}
events(app)
// or
const app = events()

.on()

const unsubscribe = app.on(`data`, console.log)
app.emit(`data`, `poof`)
// `poof`
unsubscribe()
app.emit(`data`, `wroom`)
// nothing

.once()

const unsubscribe = app.once(`start`, console.log)
app.emit(`start`, `running`)
// `running`
app.emit(`start`, `jumping`)
// nothing
1.1.0

7 years ago

0.1.0

7 years ago

0.0.2

8 years ago

0.0.1

8 years ago