cemitter

1.0.1 • Public • Published

cemitter

NPM version License Build status

Super tiny, closure-based event emitter.

Installation

npm install cemitter

Usage

const cemitter = require('cemitter')
const emitter = cemitter()
 
emitter.on('test', (data) => {
  console.log(data) // => { foo: "bar" }
})
 
emitter('test', { foo: 'bar' })

API

emitter = cemitter()

Initialize an emitter.

emitter.on(event, callback([...data]))

Register an event with the given callback.

emitter(event[, ...data])

Trigger an event and execute the corresponding callback with the given data. Aliased to emitter.on.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i cemitter

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • gummesson