diff --git a/src/global.ts b/src/global.ts index 30fa869..625df9f 100644 --- a/src/global.ts +++ b/src/global.ts @@ -140,7 +140,13 @@ class _G { } on(event: T, callback: gEventType[T]) { - return this.event.on(event, callback); + return this.event.on(event, (...args)=>{ + try{ + callback.call(this, ...args); + }catch(e){ + console.error(e) + } + }); } once(event: T, callback: gEventType[T]) {