Persist events that not yet have a handler
Open
- Dominant language
- TypeScript
- Stars
- 11.9k
- Forks
- 488
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.