EventedTests.ts
16 lines
| 349 B
| video/mp2t
|
TypeScriptLexer
cin
|
r10 | import * as Evented from "dojo/Evented"; | ||
interface DoorEvents { | ||||
open: { authorized: boolean } | ||||
close: void | ||||
} | ||||
const door = new Evented<DoorEvents>(); | ||||
door.on("open", evt => evt.authorized); | ||||
door.on<any>("location-change", (x,y,z) => x+y+z); | ||||
door.emit("open", { authorized: false }); | ||||
door.emit("close"); | ||||
door.emit<any>("location-change"); | ||||