lidire
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

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)

Package Sidebar

Install

npm i lidire

Weekly Downloads

2

Version

0.3.0

License

MIT

Unpacked Size

26.5 kB

Total Files

14

Last publish

Collaborators

  • alexpopovme