提交 e1bf432a 编写于 作者: fxy060608's avatar fxy060608

modules.js=>modules.json

上级 b691c1e4
......@@ -76,7 +76,8 @@ function parseApiManifestDeps (manifest, protocol) {
if (manifest[dep[1]]) {
dep[0] = manifest[dep[1]][0]
} else {
console.error(`依赖模块[${dep[1]}]不存在`)
console.error(`依赖模块[${dep[1]}]不存在,删除 ${name} 接口\n`)
delete manifest[name]
}
})
}
......
module.exports = {
base: {
title: '基础',
api: [
'upx2px',
'base64ToArrayBuffer',
'arrayBufferToBase64'
]
},
network: {
title: '网络',
api: [
'request',
'connectSocket',
'sendSocketMessage',
'closeSocket',
'onSocketOpen',
'onSocketError',
'onSocketMessage',
'onSocketClose',
'downloadFile',
'uploadFile'
]
},
route: {
title: '路由',
api: [
'navigateTo',
'redirectTo',
'reLaunch',
'switchTab',
'navigateBack'
]
},
storage: {
title: '数据缓存',
api: [
'setStorage',
'setStorageSync',
'getStorage',
'getStorageSync',
'removeStorage',
'removeStorageSync',
'clearStorage',
'clearStorageSync',
'getStorageInfo',
'getStorageInfoSync',
]
},
location: {
title: '位置',
api: [
'getLocation',
'openLocation',
'chooseLocation'
]
},
media: {
title: '媒体',
api: [
'chooseImage',
'previewImage',
'getImageInfo',
'saveImageToPhotosAlbum',
'compressImage',
'getRecorderManager',
'getBackgroundAudioManager',
'createInnerAudioContext',
'chooseVideo',
'saveVideoToPhotosAlbum',
'createVideoContext',
'createCameraContext',
'createLivePlayerContext'
]
},
device: {
title: '设备',
api: [
'getSystemInfo',
'getSystemInfoSync',
'canIUse',
'onMemoryWarning',
'getNetworkType',
'onNetworkStatusChange',
'onAccelerometerChange',
'startAccelerometer',
'stopAccelerometer',
'onCompassChange',
'startCompass',
'stopCompass',
'onGyroscopeChange',
'startGyroscope',
'stopGyroscope',
'makePhoneCall',
'scanCode',
'setClipboardData',
'getClipboardData',
'setScreenBrightness',
'getScreenBrightness',
'setKeepScreenOn',
'onUserCaptureScreen',
'vibrateLong',
'vibrateShort',
'addPhoneContact',
'openBluetoothAdapter',
'startBluetoothDevicesDiscovery',
'onBluetoothDeviceFound',
'stopBluetoothDevicesDiscovery',
'onBluetoothAdapterStateChange',
'getConnectedBluetoothDevices',
'getBluetoothDevices',
'getBluetoothAdapterState',
'closeBluetoothAdapter',
'writeBLECharacteristicValue',
'readBLECharacteristicValue',
'onBLEConnectionStateChange',
'onBLECharacteristicValueChange',
'notifyBLECharacteristicValueChange',
'getBLEDeviceServices',
'getBLEDeviceCharacteristics',
'createBLEConnection',
'closeBLEConnection',
'onBeaconServiceChange',
'onBeaconUpdate',
'getBeacons',
'startBeaconDiscovery',
'stopBeaconDiscovery'
]
},
ui: {
title: '界面',
api: [
'showToast',
'hideToast',
'showLoading',
'hideLoading',
'showModal',
'showActionSheet',
'setNavigationBarTitle',
'setNavigationBarColor',
'showNavigationBarLoading',
'hideNavigationBarLoading',
'setTabBarItem',
'setTabBarStyle',
'hideTabBar',
'showTabBar',
'setTabBarBadge',
'removeTabBarBadge',
'showTabBarRedDot',
'hideTabBarRedDot',
'setBackgroundColor',
'setBackgroundTextStyle',
'createAnimation',
'pageScrollTo',
'onWindowResize',
'offWindowResize',
'loadFontFace',
'startPullDownRefresh',
'stopPullDownRefresh',
'createSelectorQuery',
'createIntersectionObserver',
'hideKeyboard'
]
},
event: {
title: '页面通讯',
api: [
'$emit',
'$on',
'$once',
'$off'
]
},
file: {
title: '文件',
api: [
'saveFile',
'getSavedFileList',
'getSavedFileInfo',
'removeSavedFile',
'getFileInfo',
'openDocument',
'getFileSystemManager'
]
},
canvas: {
title: '绘画',
api: [
'createOffscreenCanvas',
'createCanvasContext',
'canvasToTempFilePath',
'canvasPutImageData',
'canvasGetImageData'
]
},
third: {
title: '第三方服务',
api: [
'getProvider',
'login',
'checkSession',
'getUserInfo',
'share',
'showShareMenu',
'hideShareMenu',
'requestPayment',
'subscribePush',
'unsubscribePush',
'onPush',
'offPush',
'requireNativePlugin'
]
}
}
[{
"name": "base",
"title": "基础",
"apiList": {
"uni.getSystemInfo": true,
"uni.getSystemInfoSync": true,
"uni.canIUse": true,
"uni.upx2px": true,
"uni.navigateTo": true,
"uni.redirectTo": true,
"uni.switchTab": true,
"uni.reLaunch": true,
"uni.navigateBack": true
}
}, {
"name": "network",
"title": "网络",
"apiList": {
"uni.request": true,
"uni.connectSocket": true,
"uni.sendSocketMessage": true,
"uni.closeSocket": true,
"uni.onSocketOpen": true,
"uni.onSocketError": true,
"uni.onSocketMessage": true,
"uni.onSocketClose": true,
"uni.downloadFile": true,
"uni.uploadFile": true
}
}, {
"name": "storage",
"title": "数据缓存",
"apiList": {
"uni.setStorage": true,
"uni.setStorageSync": true,
"uni.getStorage": true,
"uni.getStorageSync": true,
"uni.removeStorage": true,
"uni.removeStorageSync": true,
"uni.clearStorage": true,
"uni.clearStorageSync": true,
"uni.getStorageInfo": true,
"uni.getStorageInfoSync": true
}
}, {
"name": "location",
"title": "位置",
"apiList": {
"uni.getLocation": true,
"uni.openLocation": true,
"uni.chooseLocation": true
}
}, {
"name": "media",
"title": "媒体",
"apiList": {
"uni.chooseImage": true,
"uni.previewImage": true,
"uni.getImageInfo": true,
"uni.saveImageToPhotosAlbum": true,
"uni.compressImage": true,
"uni.getRecorderManager": true,
"uni.getBackgroundAudioManager": true,
"uni.createInnerAudioContext": true,
"uni.chooseVideo": true,
"uni.saveVideoToPhotosAlbum": true,
"uni.createVideoContext": true,
"uni.createCameraContext": true,
"uni.createLivePlayerContext": true
}
}, {
"name": "device",
"title": "设备",
"apiList": {
"uni.onMemoryWarning": true,
"uni.getNetworkType": true,
"uni.onNetworkStatusChange": true,
"uni.onAccelerometerChange": true,
"uni.startAccelerometer": true,
"uni.stopAccelerometer": true,
"uni.onCompassChange": true,
"uni.startCompass": true,
"uni.stopCompass": true,
"uni.onGyroscopeChange": true,
"uni.startGyroscope": true,
"uni.stopGyroscope": true,
"uni.makePhoneCall": true,
"uni.scanCode": true,
"uni.setClipboardData": true,
"uni.getClipboardData": true,
"uni.setScreenBrightness": true,
"uni.getScreenBrightness": true,
"uni.setKeepScreenOn": true,
"uni.onUserCaptureScreen": true,
"uni.vibrateLong": true,
"uni.vibrateShort": true,
"uni.addPhoneContact": true,
"uni.openBluetoothAdapter": true,
"uni.startBluetoothDevicesDiscovery": true,
"uni.onBluetoothDeviceFound": true,
"uni.stopBluetoothDevicesDiscovery": true,
"uni.onBluetoothAdapterStateChange": true,
"uni.getConnectedBluetoothDevices": true,
"uni.getBluetoothDevices": true,
"uni.getBluetoothAdapterState": true,
"uni.closeBluetoothAdapter": true,
"uni.writeBLECharacteristicValue": true,
"uni.readBLECharacteristicValue": true,
"uni.onBLEConnectionStateChange": true,
"uni.onBLECharacteristicValueChange": true,
"uni.notifyBLECharacteristicValueChange": true,
"uni.getBLEDeviceServices": true,
"uni.getBLEDeviceCharacteristics": true,
"uni.createBLEConnection": true,
"uni.closeBLEConnection": true,
"uni.onBeaconServiceChange": true,
"uni.onBeaconUpdate": true,
"uni.getBeacons": true,
"uni.startBeaconDiscovery": true,
"uni.stopBeaconDiscovery": true
}
}, {
"name": "ui",
"title": "界面",
"apiList": {
"uni.showToast": true,
"uni.hideToast": true,
"uni.showLoading": true,
"uni.hideLoading": true,
"uni.showModal": true,
"uni.showActionSheet": true,
"uni.setNavigationBarTitle": true,
"uni.setNavigationBarColor": true,
"uni.showNavigationBarLoading": true,
"uni.hideNavigationBarLoading": true,
"uni.setTabBarItem": true,
"uni.setTabBarStyle": true,
"uni.hideTabBar": true,
"uni.showTabBar": true,
"uni.setTabBarBadge": true,
"uni.removeTabBarBadge": true,
"uni.showTabBarRedDot": true,
"uni.hideTabBarRedDot": true,
"uni.setBackgroundColor": true,
"uni.setBackgroundTextStyle": true,
"uni.createAnimation": true,
"uni.pageScrollTo": true,
"uni.onWindowResize": true,
"uni.offWindowResize": true,
"uni.loadFontFace": true,
"uni.startPullDownRefresh": true,
"uni.stopPullDownRefresh": true,
"uni.createSelectorQuery": true,
"uni.createIntersectionObserver": true,
"uni.hideKeyboard": true
}
}, {
"name": "event",
"title": "页面通讯",
"apiList": {
"uni.$emit": true,
"uni.$on": true,
"uni.$once": true,
"uni.$off": true
}
}, {
"name": "file",
"title": "文件",
"apiList": {
"uni.saveFile": true,
"uni.getSavedFileList": true,
"uni.getSavedFileInfo": true,
"uni.removeSavedFile": true,
"uni.getFileInfo": true,
"uni.openDocument": true,
"uni.getFileSystemManager": true
}
}, {
"name": "canvas",
"title": "绘画",
"apiList": {
"uni.createOffscreenCanvas": true,
"uni.createCanvasContext": true,
"uni.canvasToTempFilePath": true,
"uni.canvasPutImageData": true,
"uni.canvasGetImageData": true
}
}, {
"name": "third",
"title": "第三方服务",
"apiList": {
"uni.getProvider": true,
"uni.login": true,
"uni.checkSession": true,
"uni.getUserInfo": true,
"uni.share": true,
"uni.showShareMenu": true,
"uni.hideShareMenu": true,
"uni.requestPayment": true,
"uni.subscribePush": true,
"uni.unsubscribePush": true,
"uni.onPush": true,
"uni.offPush": true,
"uni.requireNativePlugin": true,
"uni.base64ToArrayBuffer": true,
"uni.arrayBufferToBase64": true
}
}]
......@@ -7249,6 +7249,82 @@ var serviceContext = (function () {
stopCompass: stopCompass
});
const callbacks$3 = {
pause: [],
resume: [],
start: [],
stop: []
};
class RecorderManager {
constructor () {
onMethod('onRecorderStateChange', res => {
const state = res.state;
delete res.state;
delete res.errMsg;
callbacks$3[state].forEach(callback => {
if (typeof callback === 'function') {
callback(res);
}
});
});
}
onError (callback) {
callbacks$3.error.push(callback);
}
onFrameRecorded (callback) {
}
onInterruptionBegin (callback) {
}
onInterruptionEnd (callback) {
}
onPause (callback) {
callbacks$3.pause.push(callback);
}
onResume (callback) {
callbacks$3.resume.push(callback);
}
onStart (callback) {
callbacks$3.start.push(callback);
}
onStop (callback) {
callbacks$3.stop.push(callback);
}
pause () {
invokeMethod('operateRecorder', {
operationType: 'pause'
});
}
resume () {
invokeMethod('operateRecorder', {
operationType: 'resume'
});
}
start (options) {
invokeMethod('operateRecorder', Object.assign({}, options, {
operationType: 'start'
}));
}
stop () {
invokeMethod('operateRecorder', {
operationType: 'stop'
});
}
}
let recorderManager;
function getRecorderManager () {
return recorderManager || (recorderManager = new RecorderManager())
}
var require_context_module_1_7 = /*#__PURE__*/Object.freeze({
getRecorderManager: getRecorderManager
});
class DownloadTask {
constructor (downloadTaskId, callbackId) {
this.id = downloadTaskId;
......@@ -7333,7 +7409,7 @@ var serviceContext = (function () {
return task
}
var require_context_module_1_7 = /*#__PURE__*/Object.freeze({
var require_context_module_1_8 = /*#__PURE__*/Object.freeze({
downloadFile: downloadFile$1
});
......@@ -7438,7 +7514,7 @@ var serviceContext = (function () {
return new RequestTask(requestTaskId)
}
var require_context_module_1_8 = /*#__PURE__*/Object.freeze({
var require_context_module_1_9 = /*#__PURE__*/Object.freeze({
request: request$1
});
......@@ -7516,7 +7592,7 @@ var serviceContext = (function () {
const socketTasks$1 = Object.create(null);
const socketTasksArray = [];
const callbacks$3 = Object.create(null);
const callbacks$4 = Object.create(null);
onMethod('onSocketTaskStateChange', ({
socketTaskId,
state,
......@@ -7537,8 +7613,8 @@ var serviceContext = (function () {
if (state === 'open') {
socketTask.readyState = socketTask.OPEN;
}
if (socketTask === socketTasksArray[0] && callbacks$3[state]) {
invoke(callbacks$3[state], state === 'message' ? {
if (socketTask === socketTasksArray[0] && callbacks$4[state]) {
invoke(callbacks$4[state], state === 'message' ? {
data
} : {});
}
......@@ -7597,22 +7673,22 @@ var serviceContext = (function () {
}
function onSocketOpen (callbackId) {
callbacks$3.open = callbackId;
callbacks$4.open = callbackId;
}
function onSocketError (callbackId) {
callbacks$3.error = callbackId;
callbacks$4.error = callbackId;
}
function onSocketMessage (callbackId) {
callbacks$3.message = callbackId;
callbacks$4.message = callbackId;
}
function onSocketClose (callbackId) {
callbacks$3.close = callbackId;
callbacks$4.close = callbackId;
}
var require_context_module_1_9 = /*#__PURE__*/Object.freeze({
var require_context_module_1_10 = /*#__PURE__*/Object.freeze({
connectSocket: connectSocket$1,
sendSocketMessage: sendSocketMessage$1,
closeSocket: closeSocket$1,
......@@ -7706,7 +7782,7 @@ var serviceContext = (function () {
return task
}
var require_context_module_1_10 = /*#__PURE__*/Object.freeze({
var require_context_module_1_11 = /*#__PURE__*/Object.freeze({
uploadFile: uploadFile$1
});
......@@ -7815,7 +7891,7 @@ var serviceContext = (function () {
return res
}
var require_context_module_1_11 = /*#__PURE__*/Object.freeze({
var require_context_module_1_12 = /*#__PURE__*/Object.freeze({
setStorage: setStorage$1,
setStorageSync: setStorageSync$1,
getStorage: getStorage$1,
......@@ -7836,7 +7912,7 @@ var serviceContext = (function () {
return {}
}
var require_context_module_1_12 = /*#__PURE__*/Object.freeze({
var require_context_module_1_13 = /*#__PURE__*/Object.freeze({
pageScrollTo: pageScrollTo$1
});
......@@ -7852,12 +7928,13 @@ var serviceContext = (function () {
'./device/accelerometer.js': require_context_module_1_4,
'./device/bluetooth.js': require_context_module_1_5,
'./device/compass.js': require_context_module_1_6,
'./network/download-file.js': require_context_module_1_7,
'./network/request.js': require_context_module_1_8,
'./network/socket.js': require_context_module_1_9,
'./network/upload-file.js': require_context_module_1_10,
'./storage/storage.js': require_context_module_1_11,
'./ui/page-scroll-to.js': require_context_module_1_12,
'./media/recorder.js': require_context_module_1_7,
'./network/download-file.js': require_context_module_1_8,
'./network/request.js': require_context_module_1_9,
'./network/socket.js': require_context_module_1_10,
'./network/upload-file.js': require_context_module_1_11,
'./storage/storage.js': require_context_module_1_12,
'./ui/page-scroll-to.js': require_context_module_1_13,
};
var req = function req(key) {
......@@ -7918,26 +7995,22 @@ var serviceContext = (function () {
}
function findElmById (id, vm) {
return findElmByVNode(id, vm._vnode)
return findRefByElm(id, vm.$el)
}
function findElmByVNode (id, vnode) {
if (!id || !vnode) {
function findRefByElm (id, elm) {
if (!id || !elm) {
return
}
if (
vnode.data &&
vnode.data.attrs &&
vnode.data.attrs.id === id
) {
return vnode.elm
if (elm.attr.id === id) {
return elm
}
const children = vnode.children;
const children = elm.children;
if (!children) {
return
}
for (let i = 0, len = children.length; i < len; i++) {
const elm = findElmByVNode(id, children[i]);
const elm = findRefByElm(id, children[i]);
if (elm) {
return elm
}
......
......@@ -429,26 +429,22 @@ function invokeVmMethod (vm, method, args, extras) {
}
function findElmById (id, vm) {
return findElmByVNode(id, vm._vnode)
return findRefByElm(id, vm.$el)
}
function findElmByVNode (id, vnode) {
if (!id || !vnode) {
function findRefByElm (id, elm) {
if (!id || !elm) {
return
}
if (
vnode.data &&
vnode.data.attrs &&
vnode.data.attrs.id === id
) {
return vnode.elm
if (elm.attr.id === id) {
return elm
}
const children = vnode.children;
const children = elm.children;
if (!children) {
return
}
for (let i = 0, len = children.length; i < len; i++) {
const elm = findElmByVNode(id, children[i]);
const elm = findRefByElm(id, children[i]);
if (elm) {
return elm
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册