cuter

Papierkorb's "cute" (event-centric publish/subscribe model) with additions

Build status: Build Status Version License

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.

Repository

cuter

Owner
Statistic
  • 2
  • 0
  • 0
  • 0
  • 2
  • almost 6 years ago
  • June 2, 2018
License

MIT License

Links
Synced at

Sat, 27 Apr 2024 03:11:34 GMT

Languages