module Events
Defined in:
Events.crEvents/Event.cr
Events/Handler.cr
Events/Helper.cr
Events/version.cr
Constant Summary
-
VERSION =
"0.1.0"
Instance Method Summary
- #clear_handlers(name)
-
#event_exists(name : String)
Check if an event with name exists
- #invoke_event(list : Array(_), *args)
-
#invoke_event(name, *args)
Invoke an event given by name, returns an Int32 with the amount of handlers run, false if the event didn't exist
- #on(list : Array(_), &block)
-
#on(name, &block)
Add a block to the given event, returns a proc that removes the block
- #register_event(list : Array(_))
-
#register_event(name)
Registers a new event, gives it a name and returns it.
-
#remove_handler(name, &block)
Removes a block from an event given by name
-
#unregister_event(name)
Unregisters the the event given by name
Instance Method Detail
def invoke_event(name, *args)
#
Invoke an event given by name, returns an Int32 with the amount of handlers run, false if the event didn't exist
def on(name, &block)
#
Add a block to the given event, returns a proc that removes the block
Creates the event if it doesn't exist already
def register_event(name)
#
Registers a new event, gives it a name and returns it. If the event already exists, it's returned