scottcorgan / tiny-emitter

A tiny (less than 1k) event emitter library
MIT License
935 stars 67 forks source link

Is there any way to listen to all events irrespective to event name? #34

Closed shubham1164 closed 1 year ago

shubham1164 commented 5 years ago

Using

React-native 0.57

Issue

  1. I want to listen to all the events without knowing the name of the event, is it possible?
  2. I want to cancel all the events, without individually passing the name of all the events in the emitter.off() function
rdewolff commented 4 years ago

Based on the source code https://github.com/scottcorgan/tiny-emitter/blob/master/dist/tinyemitter.js - there is no way to do it.

scottcorgan commented 3 years ago

I'd be happen to get that merged if you open a PR!

Doogiemuc commented 2 years ago

There actually is. If you emit an event with undefined name, then all listeners will be notified.

Is this a bug or a feature? :-)