snorkel

1.0.0 • Public • Published

Snorkel

🏊 Event Dispatcher

Build Status Code Quality Code Coverage

Usage

import EventDispatcher from 'snorkel'
 
// Listen for an event
EventDispatcher.on('welcome', (data) => {
  console.log('The welcome event happened with ' + data)
})
 
function isReady {
  console.log('The thing is ready')
}
// Listen for an event only once
EventDispatcher.once('ready', isReady)
 
// Emit an event
EventDispatcher.emit('welcome', 'emit', 'as', 'many', 'params', 'as', 'you', 'like')
 
// Remove event listener
EventDispatcher.off('ready', isReady)
 
// Clear all event dispatchers
EventDispatcher.clear()

Package Sidebar

Install

npm i snorkel

Weekly Downloads

0

Version

1.0.0

License

ISC

Last publish

Collaborators

  • eddiemoore
  • migbuild