File hp/event/EventDispatcher.lua

Functions

M:addEventListener (eventType, callback, source, priority, evenType) Adds an event listener.
M:clearEventListeners () Remove all event listeners.
M:dispatchEvent (event) Dispatches the event.
M:hasEventListener (eventType, callback, source) Returns true if you have an event listener.
M:init (eventType) The constructor.
M:removeEventListener (eventType, callback, source) Removes an event listener.

Tables

EventDispatcher This class is has a function of event notification.


Functions

M:addEventListener (eventType, callback, source, priority, evenType)
Adds an event listener.
will now catch the events that are sent in the dispatchEvent.

Parameters

  • eventType:
  • callback: The callback function.
  • source: (option)The first argument passed to the callback function.
  • priority: (option)Notification order.
  • evenType: Target event type.
M:clearEventListeners ()
Remove all event listeners.
M:dispatchEvent (event)
Dispatches the event.

Parameters

  • event:
M:hasEventListener (eventType, callback, source)
Returns true if you have an event listener.

Parameters

  • eventType:
  • callback:
  • source:

Return value:

Returns true if you have an event listener.
M:init (eventType)
The constructor.

Parameters

  • eventType: (option)The type of event.
M:removeEventListener (eventType, callback, source)
Removes an event listener.

Parameters

  • eventType:
  • callback:
  • source:

Tables

EventDispatcher
This class is has a function of event notification.

Valid XHTML 1.0!