Category talk:Wren-event: Difference between revisions

Content added Content deleted
m (→‎Source code: Fixed syntax highlighing.)
m (→‎Event-driven programming: Added quotes to 'lang' attribute & fixed another one I missed before.)
Line 19: Line 19:
The first line of the sub-class's constructor should always be:
The first line of the sub-class's constructor should always be:


<lang ecmascript>super(name)</lang>
<syntaxhighlight lang="ecmascript">super(name)</syntaxhighlight>


to ensure the subclass object is initialized properly. Note that, as static methods are not inherited in Wren, sub-class objects are stored in the Event class's library. One can still determine the actual type of the event using its 'type' property which all objects inherit from the Object class.
to ensure the subclass object is initialized properly. Note that, as static methods are not inherited in Wren, sub-class objects are stored in the Event class's library. One can still determine the actual type of the event using its 'type' property which all objects inherit from the Object class.


===Source code===
===Source code===
<syntaxhighlight lang=ecmascript>/* Module "event.wren" */
<syntaxhighlight lang="ecmascript">/* Module "event.wren" */


import "./check" for Check
import "./check" for Check