mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2024-12-26 03:38:29 +00:00
[adapters] 兼容 iOS、Win、Mac 上多线程部分 Api 无法使用的问题
This commit is contained in:
parent
290b29770c
commit
13364c0c62
@ -1,7 +1,7 @@
|
|||||||
const isSubContext = wx.getOpenDataContext === undefined;
|
const isSubContext = wx.getOpenDataContext === undefined;
|
||||||
const sysinfo = wx.getSystemInfoSync();
|
const sysinfo = wx.getSystemInfoSync();
|
||||||
const platform = sysinfo.platform.toLowerCase();
|
const platform = sysinfo.platform.toLowerCase();
|
||||||
const isIOS = platform === "ios";
|
const isAndroid = platform === "android";
|
||||||
const sdkVersion = sysinfo.SDKVersion.split('.').map(Number);
|
const sdkVersion = sysinfo.SDKVersion.split('.').map(Number);
|
||||||
// >= 2.20.2
|
// >= 2.20.2
|
||||||
const hasWorker = sdkVersion[0] > 2 || (sdkVersion[0] === 2 && (sdkVersion[1] > 20 || (sdkVersion[1] === 20 && sdkVersion[2] >= 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 驱动资源管线(加载)
|
// 是否启用 Worker 驱动资源管线(加载)
|
||||||
globalThis.CC_WORKER_ASSET_PIPELINE_INCLUDE_LOAD = false;
|
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
|
// 是否启用 Worker
|
||||||
globalThis.CC_USE_WORKER = (CC_WORKER_ASSET_PIPELINE) && hasWorker && !isSubContext;
|
globalThis.CC_USE_WORKER = (CC_WORKER_ASSET_PIPELINE) && hasWorker && !isSubContext;
|
||||||
|
|
||||||
@ -22,5 +25,5 @@ globalThis.CC_WORKER_DEBUG = false;
|
|||||||
globalThis.CC_WORKER_SCHEDULER = true;
|
globalThis.CC_WORKER_SCHEDULER = true;
|
||||||
|
|
||||||
// 是否启用 Worker 使用同步版本的文件系统 API
|
// 是否启用 Worker 使用同步版本的文件系统 API
|
||||||
// NOTE: IOS 不支持 async 文件系统 API,Android 不支持部分 sync 文件系统 API
|
// NOTE: IOS 不支持 async 文件系统 API,Android 不支持部分 sync 文件系统 API,其余系统暂不确定
|
||||||
globalThis.CC_WORKER_FS_SYNC = isIOS;
|
globalThis.CC_WORKER_FS_SYNC = !isAndroid;
|
||||||
|
Loading…
Reference in New Issue
Block a user