1 | const statement = require("./statement.js"); |
2 |
|
3 | class Event { |
4 | constructor() { |
5 | this.statements = []; |
6 | this.push(arguments[0], arguments[1], arguments[2]); |
7 | return this; |
8 | } |
9 |
|
10 | push() { |
11 | if (arguments.length == 1) { |
12 | if (arguments[0] instanceof Event) this.statements.push(arguments[0].statements); |
13 | else if (arguments[0] instanceof statement) this.statements.push(arguments[0]); |
14 | else throw new TypeError("Expected an Event or Statement"); |
15 | } |
16 | else if (arguments.length == 3) this.statements.push(new statement(arguments[0], arguments[1], arguments[2])); |
17 | else throw new Error("Expected 1 or 3 arguments"); |
18 | return this; |
19 | } |
20 | } |
21 |
|
22 | module.exports = Event; |
23 |
|