Skip to content

a tiny emiter util, very easy to understand and use in browser and node.

Notifications You must be signed in to change notification settings

jobsteven/tinyEmiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 

Repository files navigation

ehive

a tiny ehive util, very easy to understand and use in browser and node.

usage

import ehive from 'ehive'

// general methods
ehive.on(
  'start',
  function external_fun(start_data) => {
    console.log(start_data, this)
  },
  this
)

ehive.on('end', (end_data) => {
  console.log(end_data)
})

ehive.on('*', (data) => {
  console.log('all events will be passed into listener also.')
})

ehive.once('app_init', (data) => {
  console.log('init');
})

ehive.off('eventid', elistener) // specific elistener for eid
ehive.off('start') // all elisteners for eid
ehive.off() // all elistener

// bonus, it's very usefull for debugging or handle events wholely.
ehive.has('app_start')

About

a tiny emiter util, very easy to understand and use in browser and node.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published