Difference between revisions of "EventDispatcher:addEventListener"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
+
'''Available since:''' Gideros 2011.6<br/>
<languages />
+
'''Class:''' [[EventDispatcher]]<br/>
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
+
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/EventDispatcher|EventDispatcher]]<br/>
+
=== Description ===
=== <translate>Description</translate> ===
+
Registers a listener function and an optional data value so that the listener function is called when an event of a particular type occurs.
<translate><br />
+
<syntaxhighlight lang="lua">
Registers a listener function and an optional data value so that the listener function is called when an event<br />
+
EventDispatcher:addEventListener(type,listener,data)
of a particular type occurs.<br />
+
</syntaxhighlight>
<br /></translate>
+
 
<source lang="lua">
+
=== Parameters ===
EventDispatcher:addEventListener(type,listener,data)
+
'''type''': (string) the type of event<br/>
</source>
+
'''listener''': (function) the listener function that processes the event<br/>
=== <translate>Parameters</translate> ===
+
'''data''': (any) an optional data parameter that is passed as a first argument to the listener function '''optional'''<br/>
'''type''': (string) <translate>The type of event.</translate> <br/>
+
 
'''listener''': (function) <translate>The listener function that processes the event.</translate> <br/>
+
{{EventDispatcher}}
'''data''': (any) <translate>An optional data parameter that is passed as a first argument to the listener function.</translate> '''optional'''<br/>
 

Latest revision as of 15:27, 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.

EventDispatcher:addEventListener(type,listener,data)

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