From 0c4645acc2966b9bae597587901f47a8e37274df Mon Sep 17 00:00:00 2001 From: kuangthree Date: Tue, 28 Nov 2023 22:57:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=87=BD=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E5=9C=A8=E6=9F=90=E6=89=A9=E5=B1=95=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E5=90=8E=E8=B0=83=E7=94=A8=E4=B8=80=E6=AE=B5=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/game/game.js b/game/game.js index efc710e7f..c3f5bfe28 100644 --- a/game/game.js +++ b/game/game.js @@ -40690,6 +40690,19 @@ new Promise(resolve=>{ return extensionName !== void 0 && _status.extensionLoaded.includes(extensionName); }, + runAfterExtensionLoaded(extensionName,runnable) { + if(game.hasExtensionLoaded(extensionName)){ + runnable(); + }else{ + let eventName = `Noname.Init.Extension.${extensionName}.onLoad`; + let callback = ()=>{ + lib.announce.unsubscribe(eventName,callback); + runnable(); + }; + lib.announce.subscribe(eventName,callback); + } + }, + removeExtension:(extensionName,keepFile)=>{ const prefix=`extension_${extensionName}`; Object.keys(lib.config).forEach(key=>{