0.3.0 • Published 2 years ago

lidire v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

LiDiRe

Listen, Dispatch, Remove.

Implements Event Emitter (PubSub, Observable) pattern.

Key features

  • Asynchronous listeners call
  • Can set onetime events
  • Class based to create independent emitters
  • No dependencies

Requirements

  • An event should be of Symbol type
  // Example of organizing and using Symbol events

  // ee-types.js
  export const MY_EVENT = Symbol('optional description')

  // index.js
  import { MY_EVENT } from './ee-types.js'
  
  const ee = new Lidire()
  ee.listen(MY_EVENT, listenerFn)

  // ...
  ee.dispatch(MY_EVENT, data)