微信小程序编译
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,100 @@
|
||||
import moduleHelper from './module-helper';
|
||||
import { formatJsonStr, cacheArrayBuffer, getListObject } from './utils';
|
||||
const cameraList = {};
|
||||
const getObject = getListObject(cameraList, 'camera');
|
||||
export default {
|
||||
WXCameraCreateCamera(conf, callbackId) {
|
||||
const obj = wx.createCamera({
|
||||
...formatJsonStr(conf),
|
||||
success(res) {
|
||||
moduleHelper.send('CameraCreateCallback', JSON.stringify({
|
||||
callbackId,
|
||||
type: 'success',
|
||||
res: JSON.stringify(res),
|
||||
}));
|
||||
},
|
||||
fail(res) {
|
||||
moduleHelper.send('CameraCreateCallback', JSON.stringify({
|
||||
callbackId,
|
||||
type: 'fail',
|
||||
res: JSON.stringify(res),
|
||||
}));
|
||||
},
|
||||
complete(res) {
|
||||
moduleHelper.send('CameraCreateCallback', JSON.stringify({
|
||||
callbackId,
|
||||
type: 'complete',
|
||||
res: JSON.stringify(res),
|
||||
}));
|
||||
},
|
||||
});
|
||||
cameraList[callbackId] = obj;
|
||||
},
|
||||
WXCameraCloseFrameChange(id) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj.closeFrameChange();
|
||||
},
|
||||
WXCameraDestroy(id) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj.destroy();
|
||||
},
|
||||
WXCameraListenFrameChange(id) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj.listenFrameChange();
|
||||
},
|
||||
WXCameraOnAuthCancel(id) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
const callback = (res) => {
|
||||
const resStr = JSON.stringify({
|
||||
callbackId: id,
|
||||
res: JSON.stringify(res),
|
||||
});
|
||||
moduleHelper.send('CameraOnAuthCancelCallback', resStr);
|
||||
};
|
||||
obj.onAuthCancel(callback);
|
||||
},
|
||||
WXCameraOnCameraFrame(id) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
const callback = (res) => {
|
||||
cacheArrayBuffer(id, res.data);
|
||||
const resStr = JSON.stringify({
|
||||
callbackId: id,
|
||||
res: JSON.stringify({
|
||||
width: res.width,
|
||||
height: res.height,
|
||||
}),
|
||||
});
|
||||
moduleHelper.send('CameraOnCameraFrameCallback', resStr);
|
||||
};
|
||||
obj.onCameraFrame(callback);
|
||||
},
|
||||
WXCameraOnStop(id) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
const callback = (res) => {
|
||||
const resStr = JSON.stringify({
|
||||
callbackId: id,
|
||||
res: JSON.stringify(res),
|
||||
});
|
||||
moduleHelper.send('CameraOnStopCallback', resStr);
|
||||
};
|
||||
obj.onStop(callback);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user