(event, ...args)
| 37 | } |
| 38 | |
| 39 | trigger(event, ...args) { |
| 40 | if (!isUndefined(this.bindings) && this.bindings[event]) { |
| 41 | this.bindings[event].forEach((binding, index) => { |
| 42 | const { ctx, handler, once } = binding; |
| 43 | |
| 44 | const context = ctx || this; |
| 45 | |
| 46 | handler.apply(context, args); |
| 47 | |
| 48 | if (once) { |
| 49 | this.bindings[event].splice(index, 1); |
| 50 | } |
| 51 | }); |
| 52 | } |
| 53 | |
| 54 | return this; |
| 55 | } |
| 56 | } |
no test coverage detected