developit / developit/mitt

Persist events that not yet have a handler

Aperta
#161 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
11.9k
Fork
488
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

There's a risk that a event is emitted before its' handler has been registered. You might say that such code is bad design, but I'd like to be lazy ;) Also, given that code splitting is being more and more adopted, I think this scenario is very real.

Would it be possible to persist events that don't have a handler (yet)? Whenever `.on(...)` is run, mitt would then check the persisted events in order to find unprocessed ones, and then handle those events immediately.

I think the footprint for this change can be quite small, but I can't speak for performance. Maybe we can opt-in to the behaviour.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.