Skip to content

Latest commit

 

History

History
40 lines (25 loc) · 442 Bytes

README.md

File metadata and controls

40 lines (25 loc) · 442 Bytes

easy-eventbus

Tiny eventbus lib for typescript

install


yarn add tiny-eventbus

use


import eventbus from 'tiny-eventbus'
eventbus.on('test', (params) => {
  console.log(params)
})

eventbus.emit('test', {
  value: 'hello',
})

api


on : subscribe an event

once: subscribe an event for once

emit : publish an event

off: unsubscribe an event

removeAll: remove add events