This package has been deprecated

Author message:

Moved to @mojule/events

mevents

0.1.0 • Public • Published

mevents

Dead simple event handling for mojule

const Events = require( 'mevents' )

// create a new instance
const events = Events()

let something

const setValue = value => {
  something = value

  // emit the event
  events.emit( 'change', value )
}

// registering a listener returns a function that removes the listener
const removeChangeListener = events.on( 'change', data => console.log( data ) )

// will call the listener
setValue( 42 )

// remove it
removeChangeListener()

// won't call the listener
setValue( 101 )

Readme

Keywords

Package Sidebar

Install

npm i mevents

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • nrkn