[adapters] 更改 Worker Handlers 初始化的时机;使用另一种 Audio 模块是否存在的判断方式

This commit is contained in:
SmallMain 2024-10-28 17:28:44 +08:00
parent 6c720d359d
commit d28997bcbb
No known key found for this signature in database
2 changed files with 5 additions and 3 deletions

View File

@ -3,7 +3,9 @@ if (CC_WORKER_ASSET_PIPELINE) {
ipcMain.registerHandler("assetManager", assetManagerWorkerAdapter); ipcMain.registerHandler("assetManager", assetManagerWorkerAdapter);
} }
if (CC_WORKER_AUDIO_SYSTEM && cc._Audio) { if (CC_WORKER_AUDIO_SYSTEM) {
const audioWorkerAdapter = require("./audio.js"); const audioWorkerAdapter = require("./audio.js");
if (audioWorkerAdapter.create != null) {
ipcMain.registerHandler("audioAdapter", audioWorkerAdapter); ipcMain.registerHandler("audioAdapter", audioWorkerAdapter);
} }
}

View File

@ -1,11 +1,11 @@
require("./macro"); require("./macro");
require("./ipc-main.js"); require("./ipc-main.js");
require("./handlers.js");
module.exports = { module.exports = {
init(callback) { init(callback) {
if (CC_USE_WORKER) { if (CC_USE_WORKER) {
var t = Date.now(); var t = Date.now();
require("./handlers.js");
ipcMain.init(() => { ipcMain.init(() => {
console.log("worker init cost:", Date.now() - t); console.log("worker init cost:", Date.now() - t);
console.log("worker settings:", { console.log("worker settings:", {