class EventEmitter::Base
- EventEmitter::Base
- Reference
- Object
Defined in:
event_emitter/base.crInstance Method Summary
-
#all(once = false, &block : Any -> )
Listen to all events and run the specified block.
-
#emit(event, arg = nil)
Emit an event with the specified
arg
-
#on(event, *, once = false, &block : Any -> )
Listen for a particular
event
and fire the block every time that event is called. -
#once(event, &block : Any -> )
Sugar for
on(event, once: true)
. -
#remove_listener(id_or_event)
Remove an event listener by id or event.
Instance Method Detail
Listen to all events and run the specified block. This is the
same as doing emitter.on(/.*/) { ... }
Listen for a particular event
and fire the block
every time that event is called. If #once
is true
the event will be removed after it is fired the
first time.
Sugar for on(event, once: true)
. Will fire the
event once and then remove the listener.