Difference between revisions of "EventDispatcher:addEventListener"
From GiderosMobile
m (formatting) |
m (Text replacement - "<source" to "<syntaxhighlight") |
||
Line 4: | Line 4: | ||
=== Description === | === Description === | ||
Registers a listener function and an optional data value so that the listener function is called when an event of a particular type occurs. | Registers a listener function and an optional data value so that the listener function is called when an event of a particular type occurs. | ||
− | < | + | <syntaxhighlight lang="lua"> |
EventDispatcher:addEventListener(type,listener,data) | EventDispatcher:addEventListener(type,listener,data) | ||
</source> | </source> |
Revision as of 14:26, 13 July 2023
Available since: Gideros 2011.6
Class: EventDispatcher
Description
Registers a listener function and an optional data value so that the listener function is called when an event of a particular type occurs. <syntaxhighlight lang="lua"> EventDispatcher:addEventListener(type,listener,data) </source>
Parameters
type: (string) the type of event
listener: (function) the listener function that processes the event
data: (any) an optional data parameter that is passed as a first argument to the listener function optional