From d28997bcbb5fb5689abc1d152bf23599426d2454 Mon Sep 17 00:00:00 2001 From: SmallMain Date: Mon, 28 Oct 2024 17:28:44 +0800 Subject: [PATCH] =?UTF-8?q?[adapters]=20=E6=9B=B4=E6=94=B9=20Worker=20Hand?= =?UTF-8?q?lers=20=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9A=84=E6=97=B6=E6=9C=BA?= =?UTF-8?q?=EF=BC=9B=E4=BD=BF=E7=94=A8=E5=8F=A6=E4=B8=80=E7=A7=8D=20Audio?= =?UTF-8?q?=20=E6=A8=A1=E5=9D=97=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=9A=84=E5=88=A4=E6=96=AD=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adapters/platforms/wechat/worker/handlers.js | 6 ++++-- adapters/platforms/wechat/worker/index.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/adapters/platforms/wechat/worker/handlers.js b/adapters/platforms/wechat/worker/handlers.js index dffd0f8c..e71d7aba 100644 --- a/adapters/platforms/wechat/worker/handlers.js +++ b/adapters/platforms/wechat/worker/handlers.js @@ -3,7 +3,9 @@ if (CC_WORKER_ASSET_PIPELINE) { ipcMain.registerHandler("assetManager", assetManagerWorkerAdapter); } -if (CC_WORKER_AUDIO_SYSTEM && cc._Audio) { +if (CC_WORKER_AUDIO_SYSTEM) { const audioWorkerAdapter = require("./audio.js"); - ipcMain.registerHandler("audioAdapter", audioWorkerAdapter); + if (audioWorkerAdapter.create != null) { + ipcMain.registerHandler("audioAdapter", audioWorkerAdapter); + } } diff --git a/adapters/platforms/wechat/worker/index.js b/adapters/platforms/wechat/worker/index.js index 752cf384..8b2bf664 100644 --- a/adapters/platforms/wechat/worker/index.js +++ b/adapters/platforms/wechat/worker/index.js @@ -1,11 +1,11 @@ require("./macro"); require("./ipc-main.js"); -require("./handlers.js"); module.exports = { init(callback) { if (CC_USE_WORKER) { var t = Date.now(); + require("./handlers.js"); ipcMain.init(() => { console.log("worker init cost:", Date.now() - t); console.log("worker settings:", {