(event, handler, ctx, once = false)
| 2 | |
| 3 | export class Evented { |
| 4 | on(event, handler, ctx, once = false) { |
| 5 | if (isUndefined(this.bindings)) { |
| 6 | this.bindings = {}; |
| 7 | } |
| 8 | if (isUndefined(this.bindings[event])) { |
| 9 | this.bindings[event] = []; |
| 10 | } |
| 11 | this.bindings[event].push({ handler, ctx, once }); |
| 12 | |
| 13 | return this; |
| 14 | } |
| 15 | |
| 16 | once(event, handler, ctx) { |
| 17 | return this.on(event, handler, ctx, true); |
no test coverage detected