微信小程序编译
All checks were successful
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 13s
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 17s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 35s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 15s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 33s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 3s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 5s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 15s
Plugin Library CI / publish (07.RKTools) (push) Successful in 2s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 16s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 3s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 2s
Plugin Library CI / publish (12.WeixinMinigame) (push) Successful in 2m32s
All checks were successful
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 13s
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 17s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 35s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 15s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 33s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 3s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 5s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 15s
Plugin Library CI / publish (07.RKTools) (push) Successful in 2s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 16s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 3s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 2s
Plugin Library CI / publish (12.WeixinMinigame) (push) Successful in 2m32s
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd23e48fd8f398f439a5584e4cd61052
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,70 @@
|
||||
// 消息类型
|
||||
const messageType = {
|
||||
config: 0,
|
||||
writeFile: 1, // 写文件
|
||||
};
|
||||
// @ts-ignore SDK实际有暴露这几个API,但是协议里没有
|
||||
const { createSharedArrayBuffer, getFileSystemManager } = worker;
|
||||
const fs = getFileSystemManager ? getFileSystemManager() : null;
|
||||
function compareVersion(_v1, _v2) {
|
||||
return (_v1
|
||||
.split('.')
|
||||
.map(v => v.padStart(2, '0'))
|
||||
.join('')
|
||||
>= _v2
|
||||
.split('.')
|
||||
.map(v => v.padStart(2, '0'))
|
||||
.join(''));
|
||||
}
|
||||
worker.onMessage((res) => {
|
||||
const { type, payload } = res;
|
||||
if (type === messageType.writeFile) {
|
||||
const { filePath, data, isSharedBuffer } = payload;
|
||||
let content = data;
|
||||
if (isSharedBuffer) {
|
||||
content = data.buffer;
|
||||
}
|
||||
if (!fs) {
|
||||
console.error('getFileSystemManager不存在');
|
||||
return;
|
||||
}
|
||||
fs.writeFile({
|
||||
filePath,
|
||||
data: content,
|
||||
success: () => {
|
||||
worker.postMessage({
|
||||
type: messageType.writeFile,
|
||||
payload: {
|
||||
isok: true,
|
||||
filePath,
|
||||
},
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
worker.postMessage({
|
||||
type: messageType.writeFile,
|
||||
payload: {
|
||||
isok: false,
|
||||
filePath,
|
||||
err,
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
if (type === messageType.config) {
|
||||
const { systemInfo } = payload;
|
||||
const { platform, version } = systemInfo;
|
||||
// 安卓才需要使用worker写文件
|
||||
const isAndroid = platform.toLocaleLowerCase() === 'android';
|
||||
// 8.0.18以下版本出现写文件报错
|
||||
const isClientValid = compareVersion(version, '8.0.18');
|
||||
worker.postMessage({
|
||||
type: messageType.config,
|
||||
payload: {
|
||||
supportWorkerFs: isAndroid && !!fs && isClientValid,
|
||||
supportSharedBuffer: isAndroid && !!createSharedArrayBuffer,
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f0c1c70579591542afc6c2775a3d108
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user