diff --git a/adapters/platforms/wechat/res/worker_adapter/macro.js b/adapters/platforms/wechat/res/worker_adapter/macro.js index 306a6a8e..bda96acf 100644 --- a/adapters/platforms/wechat/res/worker_adapter/macro.js +++ b/adapters/platforms/wechat/res/worker_adapter/macro.js @@ -1,7 +1,7 @@ const isSubContext = wx.getOpenDataContext === undefined; const sysinfo = wx.getSystemInfoSync(); const platform = sysinfo.platform.toLowerCase(); -const isIOS = platform === "ios"; +const isAndroid = platform === "android"; const sdkVersion = sysinfo.SDKVersion.split('.').map(Number); // >= 2.20.2 const hasWorker = sdkVersion[0] > 2 || (sdkVersion[0] === 2 && (sdkVersion[1] > 20 || (sdkVersion[1] === 20 && sdkVersion[2] >= 2))); @@ -12,6 +12,9 @@ globalThis.CC_WORKER_ASSET_PIPELINE = false; // 是否启用 Worker 驱动资源管线(加载) globalThis.CC_WORKER_ASSET_PIPELINE_INCLUDE_LOAD = false; +// NOTE 截止 2024.10.22,微信未修复 iOS、Windows、Mac 上仅文件系统 API 可以正常使用的问题 +globalThis.CC_WORKER_ASSET_PIPELINE = isAndroid && globalThis.CC_WORKER_ASSET_PIPELINE; + // 是否启用 Worker globalThis.CC_USE_WORKER = (CC_WORKER_ASSET_PIPELINE) && hasWorker && !isSubContext; @@ -22,5 +25,5 @@ globalThis.CC_WORKER_DEBUG = false; globalThis.CC_WORKER_SCHEDULER = true; // 是否启用 Worker 使用同步版本的文件系统 API -// NOTE: IOS 不支持 async 文件系统 API,Android 不支持部分 sync 文件系统 API -globalThis.CC_WORKER_FS_SYNC = isIOS; +// NOTE: IOS 不支持 async 文件系统 API,Android 不支持部分 sync 文件系统 API,其余系统暂不确定 +globalThis.CC_WORKER_FS_SYNC = !isAndroid;