github.com/docelic/cuter
master / published Jul 17, 2018 / repository
Papierkorb's "cute" (event-centric publish/subscribe model) with additions
Project status: [ ] Being developed [ ] Usable [ ] Functionally complete
Current code causes a bug: https://github.com/crystal-lang/crystal/issues/6158
Cuter is an "overlay" for Papierkorb's cute which modifies some of its built-in behavior. Specifically, it changes or adds the following:
- Blocks return Bool instead of nil
- Signals know their @parent object which has them
- Signals support one-time trigger via @listeners1 and once() instead of on()
- Every emit() also emits signal "event"
- Every on() emits signal new_listener unless new_listener itself is added
- Every off() emits signal remove_listener
- Emit() and emit2() mimick _emit() and emit() from Blessed
And some other changes are included or are coming up.
In essence, this is a specialized module aiming to duplicate Blessed's event model, and is probably not usable outside of it, due to specific and contextualized behavior.
API
- Cute
Easy to use event-oriented publisher/subscribe modelled after the Qt Framework.
- Cuter
- EventEmitter