Module event

Event system for Defold.

Have ability to create events, subscribe on them. Works across different context via changing context before calling event.

Functions

subscribe(callback[, callback_context]) Subscribe on the event
unsubscribe(callback[, callback_context]) Unsubscribe from the event
unsubscribe(callback[, callback_context]) Check if event is subscribed
trigger(args) Trigger the event
is_empty() Check if event has no any subscribed callbacks
clear() Clear all subscribed callbacks


Functions

subscribe(callback[, callback_context])
Subscribe on the event

Parameters:

  • callback function The event callback function
  • callback_context any The first argument for callback function (optional)
unsubscribe(callback[, callback_context])
Unsubscribe from the event

Parameters:

  • callback function The event callback function
  • callback_context any The first argument for callback function (optional)

Returns:

    If event was unsubscribed or not
unsubscribe(callback[, callback_context])
Check if event is subscribed

Parameters:

  • callback function The default event callback function
  • callback_context any The first argument for callback function (optional)

Returns:

    boolean Is there is event with callback and context
trigger(args)
Trigger the event

Parameters:

  • args args The args for event trigger
is_empty()
Check if event has no any subscribed callbacks

Returns:

    boolean True if event has no any subscribed callbacks
clear()
Clear all subscribed callbacks
generated by LDoc 1.4.6 Last updated 2023-05-09 21:59:57