DEV Community

Cover image for Custom Events Bubbling Extension package.
Gianluca Pistorello
Gianluca Pistorello

Posted on

Custom Events Bubbling Extension package.

Hi everybody.

I make this post to propose an alternative to "MITT" package, for anyone who is interested in event-driven development.

I know it may seem a spam-post but since the package is totally free and under MIT license with public gitHub repo, I see this post simply as an informative piece of news.

The package I posted on NPM it's called "vue-events-backbone" and it has various interesting features apart from the simple "event bus" design, and at the same time its usage remains fairly simple.
The documentation, although covering all aspects of this package with examples, it's in the readme for now.
I'm publishing a simple website where I am going to put a nicer documentation, but since I'm alone in this adventure, I'm currently prioritizing package maintenance, as it is the most important aspect.

PACKAGE FEATURES:

  1. asynchronous execution of handlers to avoid clogging main thread
  2. no Vue 3 events handling modification
  3. DOM-like event propagation through component tree
  4. plugin installer app.use compatible
  5. directive installable with app.directive to register event handlers from a component
  6. event hierarchy definable directly with event naming
  7. vue3-similar emitters instantiation
  8. emitter functions return a promise to notify when it has consumed all handlers (in eager mode or lazy)
  9. stopPropagation capability
  10. once capability
  11. transformEvent capability inside handlers to avoid stopPropagation and re-emitting the new event.
  12. emitEvent capability inside handlers to emit another event on the fly, alongside the current event
  13. custom event data to pass (even functions, objects etc...)
  14. possibility to emit an event globally instead of DOM-like events propagation
  15. error handling to avoid interrupting the propagation
  16. focus on the ease-of-use

If you have any questions, find any issues or want to propose something, write here.
I check regularly also the "issues" section of the public gitHub repo.
Here is the link to the NPM package: vue-events-backbone

Top comments (0)