提交 98bd4bc0 编写于 作者: X xiaoyucoding

modify: 适配头条小程序 API

上级 4062633e
// 不支持的 API 列表
const TODOS = [
'hideKeyboard'
'hideKeyboard',
'onSocketOpen',
'onSocketError',
'sendSocketMessage',
'onSocketMessage',
'closeSocket',
'onSocketClose',
'getImageInfo',
'getBackgroundAudioManager',
'createVideoContext',
'createCameraContext',
'createLivePlayerContext',
'getSavedFileList',
'getSavedFileInfo',
'removeSavedFile',
'getFileInfo',
'openDocument',
'chooseLocation',
'createMapContext',
'canIUse',
'onMemoryWarning',
'onGyroscopeChange',
'startGyroscope',
'stopGyroscope',
'setScreenBrightness',
'getScreenBrightness',
'onUserCaptureScreen',
'addPhoneContact',
'openBluetoothAdapter',
'startBluetoothDevicesDiscovery',
'onBluetoothDeviceFound',
'stopBluetoothDevicesDiscovery',
'onBluetoothAdapterStateChange',
'getConnectedBluetoothDevices',
'getBluetoothDevices',
'getBluetoothAdapterState',
'closeBluetoothAdapter',
'writeBLECharacteristicValue',
'readBLECharacteristicValue',
'onBLEConnectionStateChange',
'onBLECharacteristicValueChange',
'notifyBLECharacteristicValueChange',
'getBLEDeviceServices',
'getBLEDeviceCharacteristics',
'createBLEConnection',
'closeBLEConnection',
'onBeaconServiceChange',
'onBeaconUpdate',
'getBeacons',
'startBeaconDiscovery',
'stopBeaconDiscovery',
'setNavigationBarColor',
'showNavigationBarLoading',
'hideNavigationBarLoading',
'setTabBarItem',
'setTabBarStyle',
'hideTabBar',
'showTabBar',
'setTabBarBadge',
'removeTabBarBadge',
'showTabBarRedDot',
'hideTabBarRedDot',
'setBackgroundColor',
'setBackgroundTextStyle',
'createIntersectionObserver'
]
// 需要做转换的 API 列表
const protocols = {}
const protocols = {
chooseImage: {
args: {
sizeType: false
}
},
previewImage: {
args: {
indicator: false,
loop: false
}
},
connectSocket: {
args: {
method: false
}
},
chooseVideo: {
args: {
maxDuration: false
}
},
scanCode: {
args: {
onlyFromCamera: false,
scanType: false
}
},
startAccelerometer: {
args: {
interval: false
}
},
showToast: {
args: {
image: false,
mask: false
}
},
showLoading: {
args: {
mask: false
}
},
showModal: {
args: {
cancelColor: false,
confirmColor: false
}
},
showActionSheet: {
args: {
itemColor: false
}
},
login: {
args: {
scopes: false,
timeout: false
}
},
getUserInfo: {
args: {
lang: false,
timeout: false
}
},
requestPayment: {
orderInfo: 'data'
}
}
TODOS.forEach(todoApi => {
protocols[todoApi] = false
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册