(event: string, ...args: any[])
| 76 | */ |
| 77 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 78 | trigger(event: string, ...args: any[]) { |
| 79 | if (!isUndefined(this.bindings) && this.bindings[event]) { |
| 80 | this.bindings[event]?.forEach((binding, index) => { |
| 81 | const { ctx, handler, once } = binding; |
| 82 | |
| 83 | const context = ctx || this; |
| 84 | |
| 85 | handler.apply(context, args as []); |
| 86 | |
| 87 | if (once) { |
| 88 | this.bindings[event]?.splice(index, 1); |
| 89 | } |
| 90 | }); |
| 91 | } |
| 92 | |
| 93 | return this; |
| 94 | } |
| 95 | } |
no test coverage detected