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:", {