3 ms·
Heh! Not sure if it's a cosmic coincidence, but I posted something (https://news.ycombinator.com/item?id=36410781 https://news.ycombinator.com/item?id=36410781)
by abathur 3y ago
Heh! Not sure if it's a cosmic coincidence, but I posted something (https://news.ycombinator.com/item?id=36410781 https://news.ycombinator.com/item?id=36410781) similar based on https://github.com/bashup/events https://github.com/bashup/events a few hours ago in another thread.
The version here's much simpler, which has its merit if you need the performance or have a simple (append-only, exit-only) use-case.
bashup.events supports removing handlers, one-time events, pseudo-promises, and more. It's easy to use it for something like this, but also modular deferred init/load and more.
(linked comment has a little more detail on how I use it.)