Difference between revisions of "EventDispatcher:addEventListener"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === <br /> Registers a listener function and an optional data value so that the listener function is calle...")
 
m (formatting)
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
 
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Available since:''' Gideros 2011.6<br/>
 +
'''Class:''' [[EventDispatcher]]<br/>
 +
 
=== Description ===
 
=== Description ===
<br />
+
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<br />
 
of a particular type occurs.<br />
 
<br />
 
 
<source lang="lua">
 
<source lang="lua">
= EventDispatcher:addEventListener(typelistenerdata,)
+
EventDispatcher:addEventListener(type,listener,data)
 
</source>
 
</source>
'''type:''' (string) The type of event. ''''''<br/>
+
 
'''listener:''' (function) The listener function that processes the event. ''''''<br/>
+
=== Parameters ===
'''data:''' (any) An optional data parameter that is passed as a first argument to the listener function. '''optional'''<br/>
+
'''type''': (string) the type of event<br/>
 +
'''listener''': (function) the listener function that processes the event<br/>
 +
'''data''': (any) an optional data parameter that is passed as a first argument to the listener function '''optional'''<br/>
 +
 
 +
{{EventDispatcher}}

Revision as of 18:54, 8 September 2021

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