@tarojs/taro-h5 3.4.0-beta.2 → 3.4.2
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 +4 -0
- package/dist/api/ai/facial.js +5 -0
- package/dist/api/ai/index.js +2 -0
- package/dist/api/ai/visual.js +5 -0
- package/dist/api/alipay/index.js +3 -0
- package/dist/api/base/crypto.js +3 -0
- package/dist/api/base/debug.js +4 -0
- package/dist/api/base/index.js +17 -0
- package/dist/api/base/performance.js +4 -0
- package/dist/api/base/system.js +187 -0
- package/dist/api/base/update.js +4 -0
- package/dist/api/base/weapp/app-event.js +18 -0
- package/dist/api/base/weapp/life-cycle.js +4 -0
- package/dist/api/canvas/CanvasContext.js +191 -0
- package/dist/api/canvas/canvasGetImageData.js +25 -0
- package/dist/api/canvas/canvasPutImageData.js +22 -0
- package/dist/api/canvas/canvasToTempFilePath.js +22 -0
- package/dist/api/canvas/createCanvasContext.js +16 -0
- package/dist/api/canvas/index.js +12 -0
- package/dist/api/cloud/index.js +21 -0
- package/dist/api/data-analysis/index.js +5 -0
- package/dist/api/device/accelerometer.js +83 -0
- package/dist/api/device/accessibility.js +3 -0
- package/dist/api/device/battery.js +21 -0
- package/dist/api/device/bluetooth-ble.js +18 -0
- package/dist/api/device/bluetooth-peripheral.js +5 -0
- package/dist/api/device/bluetooth.js +15 -0
- package/dist/api/device/calendar.js +4 -0
- package/dist/api/device/clipboard.js +65 -0
- package/dist/api/device/compass.js +64 -0
- package/dist/api/device/contact.js +4 -0
- package/dist/api/device/crypto.js +3 -0
- package/dist/api/device/gyroscope.js +6 -0
- package/dist/api/device/iBeacon.js +9 -0
- package/dist/api/device/index.js +23 -0
- package/dist/api/device/keyboard.js +6 -0
- package/dist/api/device/memory.js +4 -0
- package/dist/api/device/motion.js +81 -0
- package/dist/api/device/network.js +78 -0
- package/dist/api/device/nfc.js +9 -0
- package/dist/api/device/phone.js +24 -0
- package/dist/api/device/scan.js +6 -0
- package/dist/api/device/screen.js +8 -0
- package/dist/api/device/vibrate.js +35 -0
- package/dist/api/device/wifi.js +13 -0
- package/dist/api/ext/index.js +4 -0
- package/dist/api/files/index.js +10 -0
- package/dist/api/framework/index.js +7 -0
- package/dist/api/index.js +24 -0
- package/dist/api/location/chooseLocation.js +93 -0
- package/dist/api/location/index.js +13 -0
- package/dist/api/location/style.css +79 -0
- package/dist/api/media/EditorContext.js +19 -0
- package/dist/api/media/audio/InnerAudioContext.js +84 -0
- package/dist/api/media/audio/index.js +15 -0
- package/dist/api/media/background-audio/BackgroundAudioManager.js +86 -0
- package/dist/api/media/background-audio/index.js +15 -0
- package/dist/api/media/camera.js +3 -0
- package/dist/api/media/image/chooseImage.js +74 -0
- package/dist/api/media/image/getImageInfo.js +31 -0
- package/dist/api/media/image/index.js +9 -0
- package/dist/api/media/image/previewImage.js +67 -0
- package/dist/api/media/index.js +12 -0
- package/dist/api/media/live.js +4 -0
- package/dist/api/media/map.js +3 -0
- package/dist/api/media/media-recorder.js +3 -0
- package/dist/api/media/recorder.js +5 -0
- package/dist/api/media/video/index.js +74 -0
- package/dist/api/media/video-decoder.js +3 -0
- package/dist/api/media/video-processing.js +3 -0
- package/dist/api/media/voip.js +16 -0
- package/dist/api/navigate/index.js +6 -0
- package/dist/api/network/download.js +124 -0
- package/dist/api/network/index.js +7 -0
- package/dist/api/network/mdns.js +12 -0
- package/dist/api/network/request/index.js +125 -0
- package/dist/api/network/tcp.js +3 -0
- package/dist/api/network/udp.js +3 -0
- package/dist/api/network/upload.js +146 -0
- package/dist/api/network/utils.js +65 -0
- package/dist/api/network/websocket/index.js +70 -0
- package/dist/api/network/websocket/socketTask.js +63 -0
- package/dist/api/open-api/account.js +3 -0
- package/dist/api/open-api/address.js +3 -0
- package/dist/api/open-api/authorize.js +4 -0
- package/dist/api/open-api/card.js +4 -0
- package/dist/api/open-api/channels-live.js +8 -0
- package/dist/api/open-api/customer-service.js +3 -0
- package/dist/api/open-api/facial.js +6 -0
- package/dist/api/open-api/favorites.js +4 -0
- package/dist/api/open-api/group.js +3 -0
- package/dist/api/open-api/index.js +18 -0
- package/dist/api/open-api/invoice.js +4 -0
- package/dist/api/open-api/license-plate.js +3 -0
- package/dist/api/open-api/login.js +5 -0
- package/dist/api/open-api/red-package.js +3 -0
- package/dist/api/open-api/settings.js +4 -0
- package/dist/api/open-api/soter.js +5 -0
- package/dist/api/open-api/subscribe-message.js +3 -0
- package/dist/api/open-api/user-info.js +4 -0
- package/dist/api/open-api/werun.js +4 -0
- package/dist/api/payment/index.js +4 -0
- package/dist/api/route/index.js +3 -0
- package/dist/api/share/index.js +12 -0
- package/dist/api/storage/background-fetch.js +6 -0
- package/dist/api/storage/index.js +157 -0
- package/dist/api/swan/index.js +26 -0
- package/dist/api/taro.js +47 -0
- package/dist/api/ui/animation/index.js +288 -0
- package/dist/api/ui/background.js +4 -0
- package/dist/api/ui/custom-component.js +3 -0
- package/dist/api/ui/fonts.js +51 -0
- package/dist/api/ui/index.js +12 -0
- package/dist/api/ui/interaction/actionSheet.js +188 -0
- package/dist/api/ui/interaction/index.js +268 -0
- package/dist/api/ui/interaction/modal.js +207 -0
- package/dist/api/ui/interaction/toast.js +195 -0
- package/dist/api/ui/menu.js +3 -0
- package/dist/api/ui/navigation-bar/index.js +42 -0
- package/dist/api/ui/pull-down-refresh.js +26 -0
- package/dist/api/ui/scroll/index.js +83 -0
- package/dist/api/ui/sticky.js +3 -0
- package/dist/api/ui/tab-bar.js +282 -0
- package/dist/api/ui/window.js +31 -0
- package/dist/api/utils/handler.js +80 -0
- package/dist/api/utils/index.js +172 -0
- package/dist/api/worker/index.js +3 -0
- package/dist/api/wxml/index.js +6 -0
- package/dist/api/wxml/nodesRef.js +42 -0
- package/dist/api/wxml/selectorQuery.js +201 -0
- package/dist/index.cjs.js +5028 -6988
- package/dist/index.js +4 -10767
- package/dist/taroApis.js +1 -1
- package/dist/types/type.js +2 -0
- package/package.json +11 -13
- package/src/api/ai/visual.ts +3 -0
- package/src/api/base/system.ts +207 -0
- package/src/api/canvas/CanvasContext.ts +42 -39
- package/src/api/canvas/createCanvasContext.ts +2 -2
- package/src/api/canvas/index.ts +10 -2
- package/src/api/cloud/index.ts +4 -0
- package/src/api/device/battery.ts +18 -1
- package/src/api/device/index.ts +1 -0
- package/src/api/{base/system → device}/network.ts +35 -15
- package/src/api/device/wifi.ts +1 -0
- package/src/api/location/chooseLocation.ts +2 -2
- package/src/api/media/{editor.ts → EditorContext.ts} +2 -0
- package/src/api/media/audio/InnerAudioContext.ts +98 -0
- package/src/api/media/audio/index.ts +1 -86
- package/src/api/media/background-audio/BackgroundAudioManager.ts +103 -0
- package/src/api/media/{background-audio.ts → background-audio/index.ts} +7 -2
- package/src/api/media/image/previewImage.ts +4 -25
- package/src/api/media/index.ts +0 -1
- package/src/api/network/download.ts +5 -5
- package/src/api/network/upload.ts +7 -13
- package/src/api/network/websocket/index.ts +1 -1
- package/src/api/ui/animation/index.ts +11 -12
- package/src/api/ui/fonts.ts +61 -2
- package/src/api/ui/interaction/index.ts +12 -10
- package/src/api/ui/navigation-bar/index.ts +2 -2
- package/src/api/ui/scroll/index.ts +3 -3
- package/src/api/utils/handler.ts +4 -4
- package/src/api/utils/index.ts +34 -13
- package/src/api/wxml/nodesRef.ts +10 -3
- package/src/api/wxml/selectorQuery.ts +68 -23
- package/src/index.ts +2 -2
- package/src/api/base/system/index.ts +0 -2
- package/src/api/base/system/info.ts +0 -64
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export class SocketTask {
|
|
2
|
+
constructor(url, protocols) {
|
|
3
|
+
if (protocols && protocols.length) {
|
|
4
|
+
this.ws = new WebSocket(url, protocols);
|
|
5
|
+
}
|
|
6
|
+
else {
|
|
7
|
+
this.ws = new WebSocket(url);
|
|
8
|
+
}
|
|
9
|
+
this.CONNECTING = 0;
|
|
10
|
+
this.OPEN = 1;
|
|
11
|
+
this.CLOSING = 2;
|
|
12
|
+
this.CLOSED = 3;
|
|
13
|
+
}
|
|
14
|
+
get readyState() {
|
|
15
|
+
return this.ws.readyState;
|
|
16
|
+
}
|
|
17
|
+
send(opts = {}) {
|
|
18
|
+
if (typeof opts !== 'object' || !opts)
|
|
19
|
+
opts = {};
|
|
20
|
+
const { data = '', success, fail, complete } = opts;
|
|
21
|
+
if (this.readyState !== 1) {
|
|
22
|
+
const res = { errMsg: 'SocketTask.send:fail SocketTask.readState is not OPEN' };
|
|
23
|
+
console.error(res.errMsg);
|
|
24
|
+
typeof fail === 'function' && fail(res);
|
|
25
|
+
typeof complete === 'function' && complete(res);
|
|
26
|
+
return Promise.reject(res);
|
|
27
|
+
}
|
|
28
|
+
this.ws.send(data);
|
|
29
|
+
const res = { errMsg: 'sendSocketMessage:ok' };
|
|
30
|
+
typeof success === 'function' && success(res);
|
|
31
|
+
typeof complete === 'function' && complete(res);
|
|
32
|
+
return Promise.resolve(res);
|
|
33
|
+
}
|
|
34
|
+
close(opts = {}) {
|
|
35
|
+
if (typeof opts !== 'object' || !opts)
|
|
36
|
+
opts = {};
|
|
37
|
+
const { code = 1000, reason = 'server complete,close', success, complete } = opts;
|
|
38
|
+
this.closeDetail = { code, reason };
|
|
39
|
+
// 主动断开时需要重置链接数
|
|
40
|
+
this._destroyWhenClose && this._destroyWhenClose();
|
|
41
|
+
this.ws.close();
|
|
42
|
+
const res = { errMsg: 'closeSocket:ok' };
|
|
43
|
+
typeof success === 'function' && success(res);
|
|
44
|
+
typeof complete === 'function' && complete(res);
|
|
45
|
+
return Promise.resolve(res);
|
|
46
|
+
}
|
|
47
|
+
onOpen(func) {
|
|
48
|
+
this.ws.onopen = func;
|
|
49
|
+
}
|
|
50
|
+
onMessage(func) {
|
|
51
|
+
this.ws.onmessage = func;
|
|
52
|
+
}
|
|
53
|
+
onClose(func) {
|
|
54
|
+
this.ws.onclose = () => {
|
|
55
|
+
// 若服务器方断掉也需要重置链接数
|
|
56
|
+
this._destroyWhenClose && this._destroyWhenClose();
|
|
57
|
+
func(this.closeDetail || { code: 1006, reason: 'abnormal closure' });
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
onError(func) {
|
|
61
|
+
this.ws.onerror = func;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils';
|
|
2
|
+
// 视频号
|
|
3
|
+
export const reserveChannelsLive = temporarilyNotSupport('reserveChannelsLive');
|
|
4
|
+
export const openChannelsLive = temporarilyNotSupport('openChannelsLive');
|
|
5
|
+
export const openChannelsEvent = temporarilyNotSupport('openChannelsEvent');
|
|
6
|
+
export const openChannelsActivity = temporarilyNotSupport('openChannelsActivity');
|
|
7
|
+
export const getChannelsLiveNoticeInfo = temporarilyNotSupport('getChannelsLiveNoticeInfo');
|
|
8
|
+
export const getChannelsLiveInfo = temporarilyNotSupport('getChannelsLiveInfo');
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils';
|
|
2
|
+
// 过往接口
|
|
3
|
+
export const checkIsSupportFacialRecognition = temporarilyNotSupport('checkIsSupportFacialRecognition');
|
|
4
|
+
export const startFacialRecognitionVerify = temporarilyNotSupport('startFacialRecognitionVerify');
|
|
5
|
+
export const startFacialRecognitionVerifyAndUploadVideo = temporarilyNotSupport('startFacialRecognitionVerifyAndUploadVideo');
|
|
6
|
+
export const faceVerifyForPay = temporarilyNotSupport('faceVerifyForPay');
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './account';
|
|
2
|
+
export * from './address';
|
|
3
|
+
export * from './authorize';
|
|
4
|
+
export * from './card';
|
|
5
|
+
export * from './channels-live';
|
|
6
|
+
export * from './customer-service';
|
|
7
|
+
export * from './facial';
|
|
8
|
+
export * from './favorites';
|
|
9
|
+
export * from './group';
|
|
10
|
+
export * from './invoice';
|
|
11
|
+
export * from './license-plate';
|
|
12
|
+
export * from './login';
|
|
13
|
+
export * from './red-package';
|
|
14
|
+
export * from './settings';
|
|
15
|
+
export * from './soter';
|
|
16
|
+
export * from './subscribe-message';
|
|
17
|
+
export * from './user-info';
|
|
18
|
+
export * from './werun';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils';
|
|
2
|
+
// 生物认证
|
|
3
|
+
export const startSoterAuthentication = temporarilyNotSupport('startSoterAuthentication');
|
|
4
|
+
export const checkIsSupportSoterAuthentication = temporarilyNotSupport('checkIsSupportSoterAuthentication');
|
|
5
|
+
export const checkIsSoterEnrolledInDevice = temporarilyNotSupport('checkIsSoterEnrolledInDevice');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils';
|
|
2
|
+
// 转发
|
|
3
|
+
export const updateShareMenu = temporarilyNotSupport('updateShareMenu');
|
|
4
|
+
export const showShareMenu = temporarilyNotSupport('showShareMenu');
|
|
5
|
+
export const showShareImageMenu = temporarilyNotSupport('showShareImageMenu');
|
|
6
|
+
export const shareVideoMessage = temporarilyNotSupport('shareVideoMessage');
|
|
7
|
+
export const shareFileMessage = temporarilyNotSupport('shareFileMessage');
|
|
8
|
+
export const onCopyUrl = temporarilyNotSupport('onCopyUrl');
|
|
9
|
+
export const offCopyUrl = temporarilyNotSupport('offCopyUrl');
|
|
10
|
+
export const hideShareMenu = temporarilyNotSupport('hideShareMenu');
|
|
11
|
+
export const getShareInfo = temporarilyNotSupport('getShareInfo');
|
|
12
|
+
export const authPrivateMessage = temporarilyNotSupport('authPrivateMessage');
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils';
|
|
2
|
+
// 周期性更新
|
|
3
|
+
export const setBackgroundFetchToken = temporarilyNotSupport('setBackgroundFetchToken');
|
|
4
|
+
export const onBackgroundFetchData = temporarilyNotSupport('onBackgroundFetchData');
|
|
5
|
+
export const getBackgroundFetchToken = temporarilyNotSupport('getBackgroundFetchToken');
|
|
6
|
+
export const getBackgroundFetchData = temporarilyNotSupport('getBackgroundFetchData');
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { shouldBeObject, getParameterError, temporarilyNotSupport } from '../utils';
|
|
2
|
+
import { MethodHandler } from '../utils/handler';
|
|
3
|
+
function getItem(key) {
|
|
4
|
+
let item;
|
|
5
|
+
try {
|
|
6
|
+
item = JSON.parse(localStorage.getItem(key) || '');
|
|
7
|
+
}
|
|
8
|
+
catch (e) { }
|
|
9
|
+
// 只返回使用 Taro.setStorage API 存储的数据
|
|
10
|
+
if (item && typeof item === 'object' && item.hasOwnProperty('data')) {
|
|
11
|
+
return { result: true, data: item.data };
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
return { result: false };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
// 数据缓存
|
|
18
|
+
export const setStorageSync = (key, data = '') => {
|
|
19
|
+
if (typeof key !== 'string') {
|
|
20
|
+
console.error(getParameterError({
|
|
21
|
+
name: 'setStorage',
|
|
22
|
+
correct: 'String',
|
|
23
|
+
wrong: key
|
|
24
|
+
}));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const type = typeof data;
|
|
28
|
+
let obj = {};
|
|
29
|
+
if (type === 'symbol') {
|
|
30
|
+
obj = { data: '' };
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
obj = { data };
|
|
34
|
+
}
|
|
35
|
+
localStorage.setItem(key, JSON.stringify(obj));
|
|
36
|
+
};
|
|
37
|
+
export const setStorage = (options) => {
|
|
38
|
+
// options must be an Object
|
|
39
|
+
const isObject = shouldBeObject(options);
|
|
40
|
+
if (!isObject.flag) {
|
|
41
|
+
const res = { errMsg: `setStorage:fail ${isObject.msg}` };
|
|
42
|
+
console.error(res.errMsg);
|
|
43
|
+
return Promise.reject(res);
|
|
44
|
+
}
|
|
45
|
+
const { key, data, success, fail, complete } = options;
|
|
46
|
+
const handle = new MethodHandler({ name: 'setStorage', success, fail, complete });
|
|
47
|
+
if (typeof key !== 'string') {
|
|
48
|
+
return handle.fail({
|
|
49
|
+
errMsg: getParameterError({
|
|
50
|
+
para: 'key',
|
|
51
|
+
correct: 'String',
|
|
52
|
+
wrong: key
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
setStorageSync(key, data);
|
|
57
|
+
return handle.success();
|
|
58
|
+
};
|
|
59
|
+
export const revokeBufferURL = temporarilyNotSupport('revokeBufferURL');
|
|
60
|
+
export const removeStorageSync = (key) => {
|
|
61
|
+
if (typeof key !== 'string') {
|
|
62
|
+
console.error(getParameterError({
|
|
63
|
+
name: 'removeStorage',
|
|
64
|
+
correct: 'String',
|
|
65
|
+
wrong: key
|
|
66
|
+
}));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
localStorage.removeItem(key);
|
|
70
|
+
};
|
|
71
|
+
export const removeStorage = (options) => {
|
|
72
|
+
// options must be an Object
|
|
73
|
+
const isObject = shouldBeObject(options);
|
|
74
|
+
if (!isObject.flag) {
|
|
75
|
+
const res = { errMsg: `removeStorage:fail ${isObject.msg}` };
|
|
76
|
+
console.error(res.errMsg);
|
|
77
|
+
return Promise.reject(res);
|
|
78
|
+
}
|
|
79
|
+
const { key, success, fail, complete } = options;
|
|
80
|
+
const handle = new MethodHandler({ name: 'removeStorage', success, fail, complete });
|
|
81
|
+
if (typeof key !== 'string') {
|
|
82
|
+
return handle.fail({
|
|
83
|
+
errMsg: getParameterError({
|
|
84
|
+
para: 'key',
|
|
85
|
+
correct: 'String',
|
|
86
|
+
wrong: key
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
removeStorageSync(key);
|
|
91
|
+
return handle.success();
|
|
92
|
+
};
|
|
93
|
+
export const getStorageSync = (key) => {
|
|
94
|
+
if (typeof key !== 'string') {
|
|
95
|
+
console.error(getParameterError({
|
|
96
|
+
name: 'getStorageSync',
|
|
97
|
+
correct: 'String',
|
|
98
|
+
wrong: key
|
|
99
|
+
}));
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const res = getItem(key);
|
|
103
|
+
if (res.result)
|
|
104
|
+
return res.data;
|
|
105
|
+
return '';
|
|
106
|
+
};
|
|
107
|
+
export const getStorageInfoSync = () => {
|
|
108
|
+
const res = {
|
|
109
|
+
keys: Object.keys(localStorage),
|
|
110
|
+
limitSize: NaN,
|
|
111
|
+
currentSize: NaN
|
|
112
|
+
};
|
|
113
|
+
return res;
|
|
114
|
+
};
|
|
115
|
+
export const getStorageInfo = ({ success, fail, complete } = {}) => {
|
|
116
|
+
const handle = new MethodHandler({ name: 'getStorageInfo', success, fail, complete });
|
|
117
|
+
return handle.success(getStorageInfoSync());
|
|
118
|
+
};
|
|
119
|
+
export const getStorage = (options) => {
|
|
120
|
+
// options must be an Object
|
|
121
|
+
const isObject = shouldBeObject(options);
|
|
122
|
+
if (!isObject.flag) {
|
|
123
|
+
const res = { errMsg: `getStorage:fail ${isObject.msg}` };
|
|
124
|
+
console.error(res.errMsg);
|
|
125
|
+
return Promise.reject(res);
|
|
126
|
+
}
|
|
127
|
+
const { key, success, fail, complete } = options;
|
|
128
|
+
const handle = new MethodHandler({ name: 'getStorage', success, fail, complete });
|
|
129
|
+
if (typeof key !== 'string') {
|
|
130
|
+
return handle.fail({
|
|
131
|
+
errMsg: getParameterError({
|
|
132
|
+
para: 'key',
|
|
133
|
+
correct: 'String',
|
|
134
|
+
wrong: key
|
|
135
|
+
})
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
const { result, data } = getItem(key);
|
|
139
|
+
if (result) {
|
|
140
|
+
return handle.success({ data });
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
return handle.fail({
|
|
144
|
+
errMsg: 'data not found'
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
export const createBufferURL = temporarilyNotSupport('createBufferURL');
|
|
149
|
+
export const clearStorageSync = () => {
|
|
150
|
+
localStorage.clear();
|
|
151
|
+
};
|
|
152
|
+
export const clearStorage = ({ success, fail, complete } = {}) => {
|
|
153
|
+
const handle = new MethodHandler({ name: 'clearStorage', success, fail, complete });
|
|
154
|
+
clearStorageSync();
|
|
155
|
+
return handle.success();
|
|
156
|
+
};
|
|
157
|
+
export * from './background-fetch';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils';
|
|
2
|
+
export const setPageInfo = temporarilyNotSupport('setPageInfo');
|
|
3
|
+
// 百度小程序 AI 相关
|
|
4
|
+
export const ocrIdCard = temporarilyNotSupport('ocrIdCard');
|
|
5
|
+
export const ocrBankCard = temporarilyNotSupport('ocrBankCard');
|
|
6
|
+
export const ocrDrivingLicense = temporarilyNotSupport('ocrDrivingLicense');
|
|
7
|
+
export const ocrVehicleLicense = temporarilyNotSupport('ocrVehicleLicense');
|
|
8
|
+
export const textReview = temporarilyNotSupport('textReview');
|
|
9
|
+
export const textToAudio = temporarilyNotSupport('textToAudio');
|
|
10
|
+
export const imageAudit = temporarilyNotSupport('imageAudit');
|
|
11
|
+
export const advancedGeneralIdentify = temporarilyNotSupport('advancedGeneralIdentify');
|
|
12
|
+
export const objectDetectIdentify = temporarilyNotSupport('objectDetectIdentify');
|
|
13
|
+
export const carClassify = temporarilyNotSupport('carClassify');
|
|
14
|
+
export const dishClassify = temporarilyNotSupport('dishClassify');
|
|
15
|
+
export const logoClassify = temporarilyNotSupport('logoClassify');
|
|
16
|
+
export const animalClassify = temporarilyNotSupport('animalClassify');
|
|
17
|
+
export const plantClassify = temporarilyNotSupport('plantClassify');
|
|
18
|
+
// 用户信息
|
|
19
|
+
export const getSwanId = temporarilyNotSupport('getSwanId');
|
|
20
|
+
// 百度收银台支付
|
|
21
|
+
export const requestPolymerPayment = temporarilyNotSupport('requestPolymerPayment');
|
|
22
|
+
// 打开小程序
|
|
23
|
+
export const navigateToSmartGameProgram = temporarilyNotSupport('navigateToSmartGameProgram');
|
|
24
|
+
export const navigateToSmartProgram = temporarilyNotSupport('navigateToSmartProgram');
|
|
25
|
+
export const navigateBackSmartProgram = temporarilyNotSupport('navigateBackSmartProgram');
|
|
26
|
+
export const preloadSubPackage = temporarilyNotSupport('preloadSubPackage');
|
package/dist/api/taro.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import Taro from '@tarojs/api';
|
|
2
|
+
import { history, createRouter } from '@tarojs/router';
|
|
3
|
+
import { getApp, getCurrentInstance, getCurrentPages, nextTick, navigateBack, navigateTo, reLaunch, redirectTo, switchTab } from '../api';
|
|
4
|
+
import { permanentlyNotSupport } from '../api/utils';
|
|
5
|
+
const { Behavior, getEnv, ENV_TYPE, Link, interceptors, getInitPxTransform, Current, options, eventCenter, Events, preload } = Taro;
|
|
6
|
+
const taro = {
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
Behavior,
|
|
9
|
+
getEnv,
|
|
10
|
+
ENV_TYPE,
|
|
11
|
+
Link,
|
|
12
|
+
interceptors,
|
|
13
|
+
Current,
|
|
14
|
+
getCurrentInstance,
|
|
15
|
+
options,
|
|
16
|
+
nextTick,
|
|
17
|
+
eventCenter,
|
|
18
|
+
Events,
|
|
19
|
+
preload,
|
|
20
|
+
history,
|
|
21
|
+
createRouter,
|
|
22
|
+
navigateBack,
|
|
23
|
+
navigateTo,
|
|
24
|
+
reLaunch,
|
|
25
|
+
redirectTo,
|
|
26
|
+
getCurrentPages,
|
|
27
|
+
switchTab
|
|
28
|
+
};
|
|
29
|
+
const initPxTransform = getInitPxTransform(taro);
|
|
30
|
+
const requirePlugin = permanentlyNotSupport('requirePlugin');
|
|
31
|
+
const pxTransform = function (size) {
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
const { designWidth } = taro.config;
|
|
34
|
+
return Math.ceil((((parseInt(size, 10) / 40) * 640) / designWidth) * 10000) / 10000 + 'rem';
|
|
35
|
+
};
|
|
36
|
+
const canIUseWebp = function () {
|
|
37
|
+
const canvas = document.createElement('canvas');
|
|
38
|
+
return canvas.toDataURL('image/webp').indexOf('data:image/webp') === 0;
|
|
39
|
+
};
|
|
40
|
+
taro.requirePlugin = requirePlugin;
|
|
41
|
+
taro.getApp = getApp;
|
|
42
|
+
taro.pxTransform = pxTransform;
|
|
43
|
+
taro.initPxTransform = initPxTransform;
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
taro.canIUseWebp = canIUseWebp;
|
|
46
|
+
export default taro;
|
|
47
|
+
export { Behavior, getEnv, ENV_TYPE, Link, interceptors, initPxTransform, Current, options, eventCenter, Events, preload, requirePlugin, pxTransform, canIUseWebp, history, createRouter };
|