From dda11bb1225f6ec7f9c0a83e155255db40e095b3 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Fri, 22 Dec 2023 14:33:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=AE=B9=E9=94=99=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/global.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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]) {