@tarojs/taro-h5 3.3.16 → 3.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/ad/index.js +3 -0
- package/dist/api/ai/facial.js +4 -0
- package/dist/api/ai/index.js +2 -0
- package/dist/api/ai/visual.js +2 -0
- package/dist/api/alipay/index.js +2 -0
- package/dist/api/base/crypto.js +2 -0
- package/dist/api/base/debug.js +4 -0
- package/dist/api/base/index.js +16 -0
- package/dist/api/base/performance.js +3 -0
- package/dist/api/base/system/index.js +2 -0
- package/dist/api/base/system/info.js +56 -0
- package/dist/api/base/system/network.js +52 -0
- package/dist/api/base/update.js +3 -0
- package/dist/api/base/weapp/app-event.js +17 -0
- package/dist/api/base/weapp/life-cycle.js +3 -0
- package/dist/api/canvas/CanvasContext.js +182 -0
- package/dist/api/canvas/canvasGetImageData.js +21 -0
- package/dist/api/canvas/canvasPutImageData.js +17 -0
- package/dist/api/canvas/canvasToTempFilePath.js +18 -0
- package/dist/api/canvas/createCanvasContext.js +13 -0
- package/dist/api/canvas/index.js +7 -0
- package/dist/api/cloud/index.js +14 -0
- package/dist/api/data-analysis/index.js +5 -0
- package/dist/api/device/accelerometer.js +71 -0
- package/dist/api/device/accessibility.js +2 -0
- package/dist/api/device/battery.js +3 -0
- package/dist/api/device/bluetooth-ble.js +17 -0
- package/dist/api/device/bluetooth-peripheral.js +4 -0
- package/dist/api/device/bluetooth.js +14 -0
- package/dist/api/device/calendar.js +3 -0
- package/dist/api/device/clipboard.js +48 -0
- package/dist/api/device/compass.js +52 -0
- package/dist/api/device/contact.js +3 -0
- package/dist/api/device/crypto.js +2 -0
- package/dist/api/device/gyroscope.js +5 -0
- package/dist/api/device/iBeacon.js +8 -0
- package/dist/api/device/index.js +22 -0
- package/dist/api/device/keyboard.js +5 -0
- package/dist/api/device/memory.js +3 -0
- package/dist/api/device/motion.js +69 -0
- package/dist/api/device/nfc.js +8 -0
- package/dist/api/device/phone.js +23 -0
- package/dist/api/device/scan.js +5 -0
- package/dist/api/device/screen.js +7 -0
- package/dist/api/device/vibrate.js +29 -0
- package/dist/api/device/wifi.js +11 -0
- package/dist/api/ext/index.js +3 -0
- package/dist/api/files/index.js +9 -0
- package/dist/api/framework/index.js +6 -0
- package/dist/api/index.js +24 -0
- package/dist/api/location/chooseLocation.js +88 -0
- package/dist/api/location/index.js +12 -0
- package/dist/api/location/style.css +79 -0
- package/dist/api/media/audio/index.js +81 -0
- package/dist/api/media/background-audio.js +10 -0
- package/dist/api/media/camera.js +2 -0
- package/dist/api/media/editor.js +17 -0
- package/dist/api/media/image/chooseImage.js +70 -0
- package/dist/api/media/image/getImageInfo.js +27 -0
- package/dist/api/media/image/index.js +8 -0
- package/dist/api/media/image/previewImage.js +57 -0
- package/dist/api/media/index.js +13 -0
- package/dist/api/media/live.js +3 -0
- package/dist/api/media/map.js +2 -0
- package/dist/api/media/media-recorder.js +2 -0
- package/dist/api/media/recorder.js +4 -0
- package/dist/api/media/video/index.js +65 -0
- package/dist/api/media/video-decoder.js +2 -0
- package/dist/api/media/video-processing.js +2 -0
- package/dist/api/media/voip.js +15 -0
- package/dist/api/navigate/index.js +5 -0
- package/dist/api/network/download.js +101 -0
- package/dist/api/network/index.js +7 -0
- package/dist/api/network/mdns.js +11 -0
- package/dist/api/network/request/index.js +123 -0
- package/dist/api/network/tcp.js +2 -0
- package/dist/api/network/udp.js +2 -0
- package/dist/api/network/upload.js +129 -0
- package/dist/api/network/utils.js +30 -0
- package/dist/api/network/websocket/index.js +65 -0
- package/dist/api/network/websocket/socketTask.js +61 -0
- package/dist/api/open-api/account.js +2 -0
- package/dist/api/open-api/address.js +2 -0
- package/dist/api/open-api/authorize.js +3 -0
- package/dist/api/open-api/card.js +3 -0
- package/dist/api/open-api/channels-live.js +7 -0
- package/dist/api/open-api/customer-service.js +2 -0
- package/dist/api/open-api/facial.js +5 -0
- package/dist/api/open-api/favorites.js +3 -0
- package/dist/api/open-api/group.js +2 -0
- package/dist/api/open-api/index.js +18 -0
- package/dist/api/open-api/invoice.js +3 -0
- package/dist/api/open-api/license-plate.js +2 -0
- package/dist/api/open-api/login.js +4 -0
- package/dist/api/open-api/red-package.js +2 -0
- package/dist/api/open-api/settings.js +3 -0
- package/dist/api/open-api/soter.js +4 -0
- package/dist/api/open-api/subscribe-message.js +2 -0
- package/dist/api/open-api/user-info.js +3 -0
- package/dist/api/open-api/werun.js +3 -0
- package/dist/api/payment/index.js +3 -0
- package/dist/api/route/index.js +1 -0
- package/dist/api/share/index.js +11 -0
- package/dist/api/storage/background-fetch.js +5 -0
- package/dist/api/storage/index.js +152 -0
- package/dist/api/swan/index.js +22 -0
- package/dist/api/taro.js +59 -0
- package/dist/api/ui/animation/index.js +250 -0
- package/dist/api/ui/background.js +3 -0
- package/dist/api/ui/custom-component.js +2 -0
- package/dist/api/ui/fonts.js +2 -0
- package/dist/api/ui/index.js +12 -0
- package/dist/api/ui/interaction/actionSheet.js +172 -0
- package/dist/api/ui/interaction/index.js +263 -0
- package/dist/api/ui/interaction/modal.js +185 -0
- package/dist/api/ui/interaction/toast.js +179 -0
- package/dist/api/ui/menu.js +2 -0
- package/dist/api/ui/navigation-bar/index.js +37 -0
- package/dist/api/ui/pull-down-refresh.js +20 -0
- package/dist/api/ui/scroll/index.js +80 -0
- package/dist/api/ui/sticky.js +2 -0
- package/dist/api/ui/tab-bar.js +250 -0
- package/dist/api/ui/window.js +22 -0
- package/dist/api/utils/handler.js +64 -0
- package/dist/api/utils/index.js +141 -0
- package/dist/api/worker/index.js +2 -0
- package/dist/api/wxml/index.js +6 -0
- package/dist/api/wxml/nodesRef.js +42 -0
- package/dist/api/wxml/selectorQuery.js +188 -0
- package/dist/index.cjs.js +7477 -10829
- package/dist/index.js +4 -0
- package/dist/taroApis.js +1 -1
- package/dist/types/type.js +2 -0
- package/package.json +12 -15
- package/src/api/ad/index.ts +5 -0
- package/src/api/ai/facial.ts +6 -0
- package/src/api/ai/index.ts +2 -0
- package/src/api/ai/visual.ts +4 -0
- package/src/api/alipay/index.ts +4 -0
- package/src/api/base/crypto.ts +4 -0
- package/src/api/base/debug.ts +5 -0
- package/src/api/base/index.ts +23 -0
- package/src/api/base/performance.ts +5 -0
- package/src/api/base/system/index.ts +2 -0
- package/src/api/base/system/info.ts +64 -0
- package/src/api/base/system/network.ts +70 -0
- package/src/api/base/update.ts +5 -0
- package/src/api/base/weapp/app-event.ts +19 -0
- package/src/api/base/weapp/life-cycle.ts +5 -0
- package/src/api/canvas/CanvasContext.ts +233 -0
- package/src/api/canvas/canvasGetImageData.ts +27 -0
- package/src/api/canvas/canvasPutImageData.ts +24 -0
- package/src/api/canvas/canvasToTempFilePath.ts +24 -0
- package/src/api/canvas/createCanvasContext.ts +18 -0
- package/src/api/canvas/index.ts +10 -0
- package/src/api/cloud/index.ts +27 -0
- package/src/api/data-analysis/index.ts +6 -0
- package/src/api/device/accelerometer.ts +87 -0
- package/src/api/device/accessibility.ts +4 -0
- package/src/api/device/battery.ts +5 -0
- package/src/api/device/bluetooth-ble.ts +19 -0
- package/src/api/device/bluetooth-peripheral.ts +6 -0
- package/src/api/device/bluetooth.ts +16 -0
- package/src/api/device/calendar.ts +5 -0
- package/src/api/device/clipboard.ts +67 -0
- package/src/api/device/compass.ts +67 -0
- package/src/api/device/contact.ts +5 -0
- package/src/api/device/crypto.ts +4 -0
- package/src/api/device/gyroscope.ts +7 -0
- package/src/api/device/iBeacon.ts +10 -0
- package/src/api/device/index.ts +22 -0
- package/src/api/device/keyboard.ts +7 -0
- package/src/api/device/memory.ts +5 -0
- package/src/api/device/motion.ts +85 -0
- package/src/api/device/nfc.ts +10 -0
- package/src/api/device/phone.ts +30 -0
- package/src/api/device/scan.ts +7 -0
- package/src/api/device/screen.ts +9 -0
- package/src/api/device/vibrate.ts +36 -0
- package/src/api/device/wifi.ts +13 -0
- package/src/api/ext/index.ts +5 -0
- package/src/api/files/index.ts +11 -0
- package/src/api/framework/index.ts +10 -0
- package/src/api/index.ts +25 -0
- package/src/api/location/chooseLocation.ts +106 -0
- package/src/api/location/index.ts +19 -0
- package/src/api/location/style.css +8 -8
- package/src/api/media/audio/index.ts +105 -0
- package/src/api/media/background-audio.ts +12 -0
- package/src/api/media/camera.ts +4 -0
- package/src/api/media/editor.ts +29 -0
- package/src/api/media/image/chooseImage.ts +78 -0
- package/src/api/media/image/getImageInfo.ts +35 -0
- package/src/api/media/image/index.ts +13 -0
- package/src/api/media/image/previewImage.ts +80 -0
- package/src/api/media/index.ts +13 -0
- package/src/api/media/live.ts +5 -0
- package/src/api/media/map.ts +4 -0
- package/src/api/media/media-recorder.ts +4 -0
- package/src/api/media/recorder.ts +6 -0
- package/src/api/media/video/index.ts +82 -0
- package/src/api/media/video-decoder.ts +4 -0
- package/src/api/media/video-processing.ts +4 -0
- package/src/api/media/voip.ts +17 -0
- package/src/api/navigate/index.ts +7 -0
- package/src/api/{fileTransfer/downloadFile.js → network/download.ts} +16 -27
- package/src/api/network/index.ts +7 -0
- package/src/api/network/mdns.ts +13 -0
- package/src/api/{request/index.js → network/request/index.ts} +9 -6
- package/src/api/network/tcp.ts +4 -0
- package/src/api/network/udp.ts +4 -0
- package/src/api/{fileTransfer/uploadFile.js → network/upload.ts} +28 -32
- package/src/api/{fileTransfer/utils.js → network/utils.ts} +0 -0
- package/src/api/network/websocket/index.ts +88 -0
- package/src/api/{webSocket/socketTask.js → network/websocket/socketTask.ts} +17 -7
- package/src/api/open-api/account.ts +4 -0
- package/src/api/open-api/address.ts +4 -0
- package/src/api/open-api/authorize.ts +5 -0
- package/src/api/open-api/card.ts +5 -0
- package/src/api/open-api/channels-live.ts +9 -0
- package/src/api/open-api/customer-service.ts +4 -0
- package/src/api/open-api/facial.ts +7 -0
- package/src/api/open-api/favorites.ts +5 -0
- package/src/api/open-api/group.ts +4 -0
- package/src/api/open-api/index.ts +18 -0
- package/src/api/open-api/invoice.ts +5 -0
- package/src/api/open-api/license-plate.ts +4 -0
- package/src/api/open-api/login.ts +6 -0
- package/src/api/open-api/red-package.ts +4 -0
- package/src/api/open-api/settings.ts +5 -0
- package/src/api/open-api/soter.ts +6 -0
- package/src/api/open-api/subscribe-message.ts +4 -0
- package/src/api/open-api/user-info.ts +5 -0
- package/src/api/open-api/werun.ts +5 -0
- package/src/api/payment/index.ts +5 -0
- package/src/api/route/index.ts +10 -0
- package/src/api/share/index.ts +13 -0
- package/src/api/storage/background-fetch.ts +7 -0
- package/src/api/storage/index.ts +181 -0
- package/src/api/swan/index.ts +31 -0
- package/src/{taro/index.js → api/taro.ts} +133 -149
- package/src/api/{createAnimation/index.js → ui/animation/index.ts} +52 -41
- package/src/api/ui/background.ts +5 -0
- package/src/api/ui/custom-component.ts +4 -0
- package/src/api/ui/fonts.ts +4 -0
- package/src/api/ui/index.ts +12 -0
- package/src/api/ui/interaction/actionSheet.ts +212 -0
- package/src/api/{interactive/index.js → ui/interaction/index.ts} +93 -77
- package/src/api/ui/interaction/modal.ts +237 -0
- package/src/api/{interactive/toast.js → ui/interaction/toast.ts} +35 -33
- package/src/api/ui/menu.ts +4 -0
- package/src/api/ui/navigation-bar/index.ts +52 -0
- package/src/api/ui/pull-down-refresh.ts +27 -0
- package/src/api/ui/scroll/index.ts +85 -0
- package/src/api/ui/sticky.ts +4 -0
- package/src/api/ui/tab-bar.ts +326 -0
- package/src/api/ui/window.ts +37 -0
- package/src/api/utils/handler.ts +105 -0
- package/src/api/utils/{index.js → index.ts} +36 -115
- package/src/api/worker/index.ts +4 -0
- package/src/api/wxml/index.ts +9 -0
- package/src/api/wxml/nodesRef.ts +56 -0
- package/src/api/wxml/selectorQuery.ts +219 -0
- package/src/index.ts +6 -0
- package/src/types/api.d.ts +4 -0
- package/src/types/define.d.ts +2 -0
- package/{types → src/types}/index.d.ts +0 -0
- package/{types → src/types}/type.ts +1 -1
- package/src/api/accelerometer/index.js +0 -105
- package/src/api/audio/index.js +0 -137
- package/src/api/canvas/canvasGetImageData.js +0 -44
- package/src/api/canvas/canvasPutImageData.js +0 -45
- package/src/api/canvas/canvasToTempFilePath.js +0 -49
- package/src/api/canvas/createCanvasContext.js +0 -340
- package/src/api/canvas/index.js +0 -4
- package/src/api/clipboard/index.js +0 -113
- package/src/api/compass/index.js +0 -99
- package/src/api/createSelectorQuery/index.js +0 -193
- package/src/api/deviceMotion/index.js +0 -105
- package/src/api/fileTransfer/index.js +0 -2
- package/src/api/image/chooseImage.js +0 -87
- package/src/api/image/getImageInfo.js +0 -74
- package/src/api/image/index.js +0 -7
- package/src/api/image/previewImage.js +0 -94
- package/src/api/index.js +0 -29
- package/src/api/interactive/actionSheet.js +0 -214
- package/src/api/interactive/modal.js +0 -256
- package/src/api/location/chooseLocation.js +0 -143
- package/src/api/location/index.js +0 -5
- package/src/api/navigationBar/index.js +0 -57
- package/src/api/open/index.js +0 -5
- package/src/api/others/index.js +0 -43
- package/src/api/pullDownRefresh/index.js +0 -51
- package/src/api/scroll/index.js +0 -99
- package/src/api/storage/index.js +0 -211
- package/src/api/system/index.js +0 -9
- package/src/api/system/info.js +0 -36
- package/src/api/system/network.js +0 -68
- package/src/api/tabBar/index.js +0 -402
- package/src/api/unsupportedApi/index.js +0 -278
- package/src/api/vibrate/index.js +0 -49
- package/src/api/video/index.js +0 -87
- package/src/api/webSocket/index.js +0 -103
- package/src/api/window/index.js +0 -38
- package/src/index.cjs.js +0 -11
- package/src/index.js +0 -6
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils'
|
|
2
|
+
|
|
3
|
+
// 生物认证
|
|
4
|
+
export const startSoterAuthentication = temporarilyNotSupport('startSoterAuthentication')
|
|
5
|
+
export const checkIsSupportSoterAuthentication = temporarilyNotSupport('checkIsSupportSoterAuthentication')
|
|
6
|
+
export const checkIsSoterEnrolledInDevice = temporarilyNotSupport('checkIsSoterEnrolledInDevice')
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils'
|
|
2
|
+
|
|
3
|
+
// 转发
|
|
4
|
+
export const updateShareMenu = temporarilyNotSupport('updateShareMenu')
|
|
5
|
+
export const showShareMenu = temporarilyNotSupport('showShareMenu')
|
|
6
|
+
export const showShareImageMenu = temporarilyNotSupport('showShareImageMenu')
|
|
7
|
+
export const shareVideoMessage = temporarilyNotSupport('shareVideoMessage')
|
|
8
|
+
export const shareFileMessage = temporarilyNotSupport('shareFileMessage')
|
|
9
|
+
export const onCopyUrl = temporarilyNotSupport('onCopyUrl')
|
|
10
|
+
export const offCopyUrl = temporarilyNotSupport('offCopyUrl')
|
|
11
|
+
export const hideShareMenu = temporarilyNotSupport('hideShareMenu')
|
|
12
|
+
export const getShareInfo = temporarilyNotSupport('getShareInfo')
|
|
13
|
+
export const authPrivateMessage = temporarilyNotSupport('authPrivateMessage')
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils'
|
|
2
|
+
|
|
3
|
+
// 周期性更新
|
|
4
|
+
export const setBackgroundFetchToken = temporarilyNotSupport('setBackgroundFetchToken')
|
|
5
|
+
export const onBackgroundFetchData = temporarilyNotSupport('onBackgroundFetchData')
|
|
6
|
+
export const getBackgroundFetchToken = temporarilyNotSupport('getBackgroundFetchToken')
|
|
7
|
+
export const getBackgroundFetchData = temporarilyNotSupport('getBackgroundFetchData')
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import Taro from '@tarojs/api'
|
|
2
|
+
import { shouldBeObject, getParameterError, temporarilyNotSupport } from '../utils'
|
|
3
|
+
import { MethodHandler } from '../utils/handler'
|
|
4
|
+
|
|
5
|
+
function getItem (key) {
|
|
6
|
+
let item
|
|
7
|
+
try {
|
|
8
|
+
item = JSON.parse(localStorage.getItem(key) || '')
|
|
9
|
+
} catch (e) {}
|
|
10
|
+
|
|
11
|
+
// 只返回使用 Taro.setStorage API 存储的数据
|
|
12
|
+
if (item && typeof item === 'object' && item.hasOwnProperty('data')) {
|
|
13
|
+
return { result: true, data: item.data }
|
|
14
|
+
} else {
|
|
15
|
+
return { result: false }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// 数据缓存
|
|
20
|
+
export const setStorageSync: typeof Taro.setStorageSync = (key, data = '') => {
|
|
21
|
+
if (typeof key !== 'string') {
|
|
22
|
+
console.error(getParameterError({
|
|
23
|
+
name: 'setStorage',
|
|
24
|
+
correct: 'String',
|
|
25
|
+
wrong: key
|
|
26
|
+
}))
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const type = typeof data
|
|
31
|
+
let obj = {}
|
|
32
|
+
|
|
33
|
+
if (type === 'symbol') {
|
|
34
|
+
obj = { data: '' }
|
|
35
|
+
} else {
|
|
36
|
+
obj = { data }
|
|
37
|
+
}
|
|
38
|
+
localStorage.setItem(key, JSON.stringify(obj))
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const setStorage: typeof Taro.setStorage = (options) => {
|
|
42
|
+
// options must be an Object
|
|
43
|
+
const isObject = shouldBeObject(options)
|
|
44
|
+
if (!isObject.flag) {
|
|
45
|
+
const res = { errMsg: `setStorage:fail ${isObject.msg}` }
|
|
46
|
+
console.error(res.errMsg)
|
|
47
|
+
return Promise.reject(res)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const { key, data, success, fail, complete } = options
|
|
51
|
+
const handle = new MethodHandler({ name: 'setStorage', success, fail, complete })
|
|
52
|
+
|
|
53
|
+
if (typeof key !== 'string') {
|
|
54
|
+
return handle.fail({
|
|
55
|
+
errMsg: getParameterError({
|
|
56
|
+
para: 'key',
|
|
57
|
+
correct: 'String',
|
|
58
|
+
wrong: key
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
setStorageSync(key, data)
|
|
64
|
+
return handle.success()
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const revokeBufferURL = temporarilyNotSupport('revokeBufferURL')
|
|
68
|
+
|
|
69
|
+
export const removeStorageSync: typeof Taro.removeStorageSync = (key: string) => {
|
|
70
|
+
if (typeof key !== 'string') {
|
|
71
|
+
console.error(getParameterError({
|
|
72
|
+
name: 'removeStorage',
|
|
73
|
+
correct: 'String',
|
|
74
|
+
wrong: key
|
|
75
|
+
}))
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
localStorage.removeItem(key)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const removeStorage: typeof Taro.removeStorage = (options: Taro.removeStorage.Option) => {
|
|
83
|
+
// options must be an Object
|
|
84
|
+
const isObject = shouldBeObject(options)
|
|
85
|
+
if (!isObject.flag) {
|
|
86
|
+
const res = { errMsg: `removeStorage:fail ${isObject.msg}` }
|
|
87
|
+
console.error(res.errMsg)
|
|
88
|
+
return Promise.reject(res)
|
|
89
|
+
}
|
|
90
|
+
const { key, success, fail, complete } = options
|
|
91
|
+
const handle = new MethodHandler({ name: 'removeStorage', success, fail, complete })
|
|
92
|
+
|
|
93
|
+
if (typeof key !== 'string') {
|
|
94
|
+
return handle.fail({
|
|
95
|
+
errMsg: getParameterError({
|
|
96
|
+
para: 'key',
|
|
97
|
+
correct: 'String',
|
|
98
|
+
wrong: key
|
|
99
|
+
})
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
removeStorageSync(key)
|
|
104
|
+
return handle.success()
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export const getStorageSync: typeof Taro.getStorageSync = (key) => {
|
|
108
|
+
if (typeof key !== 'string') {
|
|
109
|
+
console.error(getParameterError({
|
|
110
|
+
name: 'getStorageSync',
|
|
111
|
+
correct: 'String',
|
|
112
|
+
wrong: key
|
|
113
|
+
}))
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const res = getItem(key)
|
|
118
|
+
if (res.result) return res.data
|
|
119
|
+
|
|
120
|
+
return ''
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export const getStorageInfoSync: typeof Taro.getStorageInfoSync = () => {
|
|
124
|
+
const res: Taro.getStorageInfoSync.Option = {
|
|
125
|
+
keys: Object.keys(localStorage),
|
|
126
|
+
limitSize: NaN,
|
|
127
|
+
currentSize: NaN
|
|
128
|
+
}
|
|
129
|
+
return res
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const getStorageInfo: typeof Taro.getStorageInfo = ({ success, fail, complete } = {}) => {
|
|
133
|
+
const handle = new MethodHandler<Taro.getStorageInfo.SuccessCallbackOption>({ name: 'getStorageInfo', success, fail, complete })
|
|
134
|
+
return handle.success(getStorageInfoSync())
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export const getStorage: typeof Taro.getStorage = <T>(options) => {
|
|
138
|
+
// options must be an Object
|
|
139
|
+
const isObject = shouldBeObject(options)
|
|
140
|
+
if (!isObject.flag) {
|
|
141
|
+
const res = { errMsg: `getStorage:fail ${isObject.msg}` }
|
|
142
|
+
console.error(res.errMsg)
|
|
143
|
+
return Promise.reject(res)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const { key, success, fail, complete } = options
|
|
147
|
+
const handle = new MethodHandler<Taro.getStorage.SuccessCallbackResult<T>>({ name: 'getStorage', success, fail, complete })
|
|
148
|
+
|
|
149
|
+
if (typeof key !== 'string') {
|
|
150
|
+
return handle.fail({
|
|
151
|
+
errMsg: getParameterError({
|
|
152
|
+
para: 'key',
|
|
153
|
+
correct: 'String',
|
|
154
|
+
wrong: key
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const { result, data } = getItem(key)
|
|
160
|
+
if (result) {
|
|
161
|
+
return handle.success({ data })
|
|
162
|
+
} else {
|
|
163
|
+
return handle.fail({
|
|
164
|
+
errMsg: 'data not found'
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export const createBufferURL = temporarilyNotSupport('createBufferURL')
|
|
170
|
+
|
|
171
|
+
export const clearStorageSync: typeof Taro.clearStorageSync = () => {
|
|
172
|
+
localStorage.clear()
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export const clearStorage: typeof Taro.clearStorage = ({ success, fail, complete } = {}) => {
|
|
176
|
+
const handle = new MethodHandler({ name: 'clearStorage', success, fail, complete })
|
|
177
|
+
clearStorageSync()
|
|
178
|
+
return handle.success()
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export * from './background-fetch'
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils'
|
|
2
|
+
|
|
3
|
+
export const setPageInfo = temporarilyNotSupport('setPageInfo')
|
|
4
|
+
|
|
5
|
+
// 百度小程序 AI 相关
|
|
6
|
+
export const ocrIdCard = temporarilyNotSupport('ocrIdCard')
|
|
7
|
+
export const ocrBankCard = temporarilyNotSupport('ocrBankCard')
|
|
8
|
+
export const ocrDrivingLicense = temporarilyNotSupport('ocrDrivingLicense')
|
|
9
|
+
export const ocrVehicleLicense = temporarilyNotSupport('ocrVehicleLicense')
|
|
10
|
+
export const textReview = temporarilyNotSupport('textReview')
|
|
11
|
+
export const textToAudio = temporarilyNotSupport('textToAudio')
|
|
12
|
+
export const imageAudit = temporarilyNotSupport('imageAudit')
|
|
13
|
+
export const advancedGeneralIdentify = temporarilyNotSupport('advancedGeneralIdentify')
|
|
14
|
+
export const objectDetectIdentify = temporarilyNotSupport('objectDetectIdentify')
|
|
15
|
+
export const carClassify = temporarilyNotSupport('carClassify')
|
|
16
|
+
export const dishClassify = temporarilyNotSupport('dishClassify')
|
|
17
|
+
export const logoClassify = temporarilyNotSupport('logoClassify')
|
|
18
|
+
export const animalClassify = temporarilyNotSupport('animalClassify')
|
|
19
|
+
export const plantClassify = temporarilyNotSupport('plantClassify')
|
|
20
|
+
|
|
21
|
+
// 用户信息
|
|
22
|
+
export const getSwanId = temporarilyNotSupport('getSwanId')
|
|
23
|
+
|
|
24
|
+
// 百度收银台支付
|
|
25
|
+
export const requestPolymerPayment = temporarilyNotSupport('requestPolymerPayment')
|
|
26
|
+
|
|
27
|
+
// 打开小程序
|
|
28
|
+
export const navigateToSmartGameProgram = temporarilyNotSupport('navigateToSmartGameProgram')
|
|
29
|
+
export const navigateToSmartProgram = temporarilyNotSupport('navigateToSmartProgram')
|
|
30
|
+
export const navigateBackSmartProgram = temporarilyNotSupport('navigateBackSmartProgram')
|
|
31
|
+
export const preloadSubPackage = temporarilyNotSupport('preloadSubPackage')
|
|
@@ -1,149 +1,133 @@
|
|
|
1
|
-
import Taro from '@tarojs/api'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
history,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
useDidShow,
|
|
135
|
-
useDidHide,
|
|
136
|
-
usePullDownRefresh,
|
|
137
|
-
useReachBottom,
|
|
138
|
-
usePageScroll,
|
|
139
|
-
useResize,
|
|
140
|
-
useShareAppMessage,
|
|
141
|
-
useTabItemTap,
|
|
142
|
-
useTitleClick,
|
|
143
|
-
useOptionMenuClick,
|
|
144
|
-
usePullIntercept,
|
|
145
|
-
useShareTimeline,
|
|
146
|
-
useAddToFavorites,
|
|
147
|
-
useReady,
|
|
148
|
-
useRouter
|
|
149
|
-
}
|
|
1
|
+
import Taro from '@tarojs/api'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
history,
|
|
5
|
+
createRouter
|
|
6
|
+
} from '@tarojs/router'
|
|
7
|
+
import { getApp, getCurrentInstance, getCurrentPages, nextTick, navigateBack, navigateTo, reLaunch, redirectTo, switchTab } from '../api'
|
|
8
|
+
import { permanentlyNotSupport } from '../api/utils'
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
Behavior,
|
|
12
|
+
getEnv,
|
|
13
|
+
ENV_TYPE,
|
|
14
|
+
Link,
|
|
15
|
+
interceptors,
|
|
16
|
+
getInitPxTransform,
|
|
17
|
+
Current,
|
|
18
|
+
options,
|
|
19
|
+
eventCenter,
|
|
20
|
+
Events,
|
|
21
|
+
preload,
|
|
22
|
+
useDidShow,
|
|
23
|
+
useDidHide,
|
|
24
|
+
usePullDownRefresh,
|
|
25
|
+
useReachBottom,
|
|
26
|
+
usePageScroll,
|
|
27
|
+
useResize,
|
|
28
|
+
useShareAppMessage,
|
|
29
|
+
useTabItemTap,
|
|
30
|
+
useTitleClick,
|
|
31
|
+
useOptionMenuClick,
|
|
32
|
+
usePullIntercept,
|
|
33
|
+
useShareTimeline,
|
|
34
|
+
useAddToFavorites,
|
|
35
|
+
useReady,
|
|
36
|
+
useRouter
|
|
37
|
+
} = Taro as any
|
|
38
|
+
|
|
39
|
+
const taro: typeof Taro = {
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
Behavior,
|
|
42
|
+
getEnv,
|
|
43
|
+
ENV_TYPE,
|
|
44
|
+
Link,
|
|
45
|
+
interceptors,
|
|
46
|
+
Current,
|
|
47
|
+
getCurrentInstance,
|
|
48
|
+
options,
|
|
49
|
+
nextTick,
|
|
50
|
+
eventCenter,
|
|
51
|
+
Events,
|
|
52
|
+
preload,
|
|
53
|
+
history,
|
|
54
|
+
createRouter,
|
|
55
|
+
navigateBack,
|
|
56
|
+
navigateTo,
|
|
57
|
+
reLaunch,
|
|
58
|
+
redirectTo,
|
|
59
|
+
getCurrentPages,
|
|
60
|
+
switchTab,
|
|
61
|
+
useDidShow,
|
|
62
|
+
useDidHide,
|
|
63
|
+
usePullDownRefresh,
|
|
64
|
+
useReachBottom,
|
|
65
|
+
usePageScroll,
|
|
66
|
+
useResize,
|
|
67
|
+
useShareAppMessage,
|
|
68
|
+
useTabItemTap,
|
|
69
|
+
useTitleClick,
|
|
70
|
+
useOptionMenuClick,
|
|
71
|
+
usePullIntercept,
|
|
72
|
+
useShareTimeline,
|
|
73
|
+
useAddToFavorites,
|
|
74
|
+
useReady,
|
|
75
|
+
useRouter
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const initPxTransform = getInitPxTransform(taro)
|
|
79
|
+
|
|
80
|
+
const requirePlugin = permanentlyNotSupport('requirePlugin')
|
|
81
|
+
|
|
82
|
+
const pxTransform = function (size) {
|
|
83
|
+
// @ts-ignore
|
|
84
|
+
const { designWidth } = taro.config
|
|
85
|
+
return Math.ceil((((parseInt(size, 10) / 40) * 640) / designWidth) * 10000) / 10000 + 'rem'
|
|
86
|
+
}
|
|
87
|
+
const canIUseWebp = function () {
|
|
88
|
+
const canvas = document.createElement('canvas')
|
|
89
|
+
return canvas.toDataURL('image/webp').indexOf('data:image/webp') === 0
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
taro.requirePlugin = requirePlugin
|
|
93
|
+
taro.getApp = getApp
|
|
94
|
+
taro.pxTransform = pxTransform
|
|
95
|
+
taro.initPxTransform = initPxTransform
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
taro.canIUseWebp = canIUseWebp
|
|
98
|
+
|
|
99
|
+
export default taro
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
Behavior,
|
|
103
|
+
getEnv,
|
|
104
|
+
ENV_TYPE,
|
|
105
|
+
Link,
|
|
106
|
+
interceptors,
|
|
107
|
+
initPxTransform,
|
|
108
|
+
Current,
|
|
109
|
+
options,
|
|
110
|
+
eventCenter,
|
|
111
|
+
Events,
|
|
112
|
+
preload,
|
|
113
|
+
requirePlugin,
|
|
114
|
+
pxTransform,
|
|
115
|
+
canIUseWebp,
|
|
116
|
+
history,
|
|
117
|
+
createRouter,
|
|
118
|
+
useDidShow,
|
|
119
|
+
useDidHide,
|
|
120
|
+
usePullDownRefresh,
|
|
121
|
+
useReachBottom,
|
|
122
|
+
usePageScroll,
|
|
123
|
+
useResize,
|
|
124
|
+
useShareAppMessage,
|
|
125
|
+
useTabItemTap,
|
|
126
|
+
useTitleClick,
|
|
127
|
+
useOptionMenuClick,
|
|
128
|
+
usePullIntercept,
|
|
129
|
+
useShareTimeline,
|
|
130
|
+
useAddToFavorites,
|
|
131
|
+
useReady,
|
|
132
|
+
useRouter
|
|
133
|
+
}
|