Skip to content

Commit 5a28796

Browse files
committed
Update
1 parent 0ab902c commit 5a28796

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

TODO

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
- [ ] Statements
2929
- [ ] Directives
3030
- [ ] Definition constructs
31+
- [ ] Annotatable definitions beginning with `[` take the place of the array literal in the directive grammar, as they may begin with meta-data.
3132
- [ ] Global objects
3233
- [ ] trace
3334
- [ ] encodeURI

src/overview/event-model.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,13 @@ In addition, the `IEventTarget` interface may be implemented instead of extendin
99
The following program demonstrates implementing a basic `EventTarget` subclass that is able to emit events:
1010

1111
```
12-
/**
13-
* On play event.
14-
*/
15-
[Event(name="play", type="Event")]
16-
/**
17-
* My player class.
18-
*/
19-
class Player extends EventTarget {
20-
21-
public function aMethod() {
22-
this.emit(new Event("play"));
12+
/** Some event. */
13+
[Event(name="act", type="Event")]
14+
/** Some class. */
15+
class Actor extends EventTarget {
16+
//
17+
public function m() {
18+
this.emit(new Event("act"));
2319
}
2420
}
2521
```
@@ -29,7 +25,7 @@ class Player extends EventTarget {
2925
Subscribing to an event looks as follows:
3026

3127
```
32-
player.on("play", function() { trace("played") });
28+
actor.on("act", function() { trace("acting") });
3329
```
3430

3531
## Implementing an event class

0 commit comments

Comments
 (0)