@tarojs/taro-h5 3.6.6-alpha.2 → 3.6.6-alpha.3
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/base/index.d.ts +1 -2
- package/dist/api/base/index.js +3 -3
- package/dist/api/base/index.js.map +1 -1
- package/dist/api/base/weapp/app-event.d.ts +10 -10
- package/dist/api/base/weapp/app-event.js +77 -9
- package/dist/api/base/weapp/app-event.js.map +1 -1
- package/dist/api/canvas/CanvasContext.d.ts +2 -1
- package/dist/api/canvas/CanvasContext.js.map +1 -1
- package/dist/api/device/accelerometer.js +1 -2
- package/dist/api/device/accelerometer.js.map +1 -1
- package/dist/api/device/compass.js +1 -2
- package/dist/api/device/compass.js.map +1 -1
- package/dist/api/device/motion.js +1 -2
- package/dist/api/device/motion.js.map +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/network/request/index.d.ts +1 -1
- package/dist/api/network/request/index.js +22 -17
- package/dist/api/network/request/index.js.map +1 -1
- package/dist/index.cjs.d.ts +27 -39
- package/dist/index.cjs.js +132 -125
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.d.ts +27 -39
- package/dist/index.esm.js +105 -74
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/handler.d.ts +13 -26
- package/dist/utils/handler.js +4 -16
- package/dist/utils/handler.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +15 -11
- package/dist/utils/lodash.d.ts +0 -3
- package/dist/utils/lodash.js +0 -32
- package/dist/utils/lodash.js.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -9,35 +9,13 @@ var utils = require('@tarojs/router/dist/utils');
|
|
|
9
9
|
var runtime = require('@tarojs/runtime');
|
|
10
10
|
var base64Js = require('base64-js');
|
|
11
11
|
var navigate = require('@tarojs/router/dist/utils/navigate');
|
|
12
|
+
var lodashEs = require('lodash-es');
|
|
12
13
|
var queryString = require('query-string');
|
|
13
14
|
var components = require('@tarojs/components/dist/components');
|
|
14
15
|
require('whatwg-fetch');
|
|
15
16
|
require('abortcontroller-polyfill/dist/abortcontroller-polyfill-only');
|
|
16
17
|
var jsonpRetry = require('jsonp-retry');
|
|
17
18
|
|
|
18
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
|
-
|
|
20
|
-
function _interopNamespace(e) {
|
|
21
|
-
if (e && e.__esModule) return e;
|
|
22
|
-
var n = Object.create(null);
|
|
23
|
-
if (e) {
|
|
24
|
-
Object.keys(e).forEach(function (k) {
|
|
25
|
-
if (k !== 'default') {
|
|
26
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
27
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
get: function () { return e[k]; }
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
n["default"] = e;
|
|
35
|
-
return Object.freeze(n);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var Taro__default = /*#__PURE__*/_interopDefaultLegacy(Taro);
|
|
39
|
-
var jsonpRetry__default = /*#__PURE__*/_interopDefaultLegacy(jsonpRetry);
|
|
40
|
-
|
|
41
19
|
class MethodHandler {
|
|
42
20
|
constructor({ name, success, fail, complete }) {
|
|
43
21
|
this.isHandlerError = false;
|
|
@@ -74,18 +52,12 @@ class MethodHandler {
|
|
|
74
52
|
class CallbackManager {
|
|
75
53
|
constructor() {
|
|
76
54
|
this.callbacks = [];
|
|
77
|
-
/**
|
|
78
|
-
* 添加回调
|
|
79
|
-
* @param {{ callback: function, ctx: any } | function} opt
|
|
80
|
-
*/
|
|
55
|
+
/** 添加回调 */
|
|
81
56
|
this.add = (opt) => {
|
|
82
57
|
if (opt)
|
|
83
58
|
this.callbacks.push(opt);
|
|
84
59
|
};
|
|
85
|
-
/**
|
|
86
|
-
* 移除回调
|
|
87
|
-
* @param {{ callback: function, ctx: any } | function} opt
|
|
88
|
-
*/
|
|
60
|
+
/** 移除回调 */
|
|
89
61
|
this.remove = (opt) => {
|
|
90
62
|
if (opt) {
|
|
91
63
|
let pos = -1;
|
|
@@ -99,17 +71,11 @@ class CallbackManager {
|
|
|
99
71
|
}
|
|
100
72
|
}
|
|
101
73
|
};
|
|
102
|
-
/**
|
|
103
|
-
* 获取回调函数数量
|
|
104
|
-
* @return {number}
|
|
105
|
-
*/
|
|
74
|
+
/** 获取回调函数数量 */
|
|
106
75
|
this.count = () => {
|
|
107
76
|
return this.callbacks.length;
|
|
108
77
|
};
|
|
109
|
-
/**
|
|
110
|
-
* 触发回调
|
|
111
|
-
* @param {...any} args 回调的调用参数
|
|
112
|
-
*/
|
|
78
|
+
/** 触发回调 */
|
|
113
79
|
this.trigger = (...args) => {
|
|
114
80
|
this.callbacks.forEach(opt => {
|
|
115
81
|
if (shared.isFunction(opt)) {
|
|
@@ -139,36 +105,6 @@ const getTimingFunc = (easeFunc, frameCnt) => {
|
|
|
139
105
|
};
|
|
140
106
|
};
|
|
141
107
|
|
|
142
|
-
function throttle(fn, threshold = 250, scope) {
|
|
143
|
-
let lastTime = 0;
|
|
144
|
-
let deferTimer;
|
|
145
|
-
return function (...args) {
|
|
146
|
-
const context = scope || this;
|
|
147
|
-
const now = Date.now();
|
|
148
|
-
if (now - lastTime > threshold) {
|
|
149
|
-
fn.apply(this, args);
|
|
150
|
-
lastTime = now;
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
clearTimeout(deferTimer);
|
|
154
|
-
deferTimer = setTimeout(() => {
|
|
155
|
-
lastTime = now;
|
|
156
|
-
fn.apply(context, args);
|
|
157
|
-
}, threshold);
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
function debounce(fn, ms = 250, scope) {
|
|
162
|
-
let timer;
|
|
163
|
-
return function (...args) {
|
|
164
|
-
const context = scope || this;
|
|
165
|
-
clearTimeout(timer);
|
|
166
|
-
timer = setTimeout(function () {
|
|
167
|
-
fn.apply(context, args);
|
|
168
|
-
}, ms);
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
|
|
172
108
|
const VALID_COLOR_REG = /^#[0-9a-fA-F]{6}$/;
|
|
173
109
|
const isValidColor = (color) => {
|
|
174
110
|
return VALID_COLOR_REG.test(color);
|
|
@@ -247,7 +183,7 @@ function temporarilyNotSupport(name = '') {
|
|
|
247
183
|
const { success, fail, complete } = option;
|
|
248
184
|
const handle = new MethodHandler({ name, success, fail, complete });
|
|
249
185
|
const errMsg = '暂时不支持 API';
|
|
250
|
-
|
|
186
|
+
Taro.eventCenter.trigger('__taroNotSupport', {
|
|
251
187
|
name,
|
|
252
188
|
args: [option, ...args],
|
|
253
189
|
type: 'method',
|
|
@@ -267,7 +203,7 @@ function weixinCorpSupport(name) {
|
|
|
267
203
|
const { success, fail, complete } = option;
|
|
268
204
|
const handle = new MethodHandler({ name, success, fail, complete });
|
|
269
205
|
const errMsg = 'h5 端当前仅在微信公众号 JS-SDK 环境下支持此 API';
|
|
270
|
-
|
|
206
|
+
Taro.eventCenter.trigger('__taroNotSupport', {
|
|
271
207
|
name,
|
|
272
208
|
args: [option, ...args],
|
|
273
209
|
type: 'method',
|
|
@@ -287,7 +223,7 @@ function permanentlyNotSupport(name = '') {
|
|
|
287
223
|
const { success, fail, complete } = option;
|
|
288
224
|
const handle = new MethodHandler({ name, success, fail, complete });
|
|
289
225
|
const errMsg = '不支持 API';
|
|
290
|
-
|
|
226
|
+
Taro.eventCenter.trigger('__taroNotSupport', {
|
|
291
227
|
name,
|
|
292
228
|
args: [option, ...args],
|
|
293
229
|
type: 'method',
|
|
@@ -860,14 +796,34 @@ const getSystemInfo = (options = {}) => __awaiter(void 0, void 0, void 0, functi
|
|
|
860
796
|
const updateWeChatApp = temporarilyNotSupport('updateWeChatApp');
|
|
861
797
|
const getUpdateManager = temporarilyNotSupport('getUpdateManager');
|
|
862
798
|
|
|
799
|
+
const unhandledRejectionCallbackManager = new CallbackManager();
|
|
800
|
+
const themeChangeCallbackManager = new CallbackManager();
|
|
801
|
+
const pageNotFoundCallbackManager = new CallbackManager();
|
|
802
|
+
const errorCallbackManager = new CallbackManager();
|
|
863
803
|
const appShowCallbackManager = new CallbackManager();
|
|
864
804
|
const appHideCallbackManager = new CallbackManager();
|
|
805
|
+
const unhandledRejectionListener = (res) => {
|
|
806
|
+
unhandledRejectionCallbackManager.trigger(res);
|
|
807
|
+
};
|
|
808
|
+
let themeMatchMedia = null;
|
|
809
|
+
const themeChangeListener = (res) => {
|
|
810
|
+
themeChangeCallbackManager.trigger({
|
|
811
|
+
theme: res.matches ? 'dark' : 'light'
|
|
812
|
+
});
|
|
813
|
+
};
|
|
814
|
+
const pageNotFoundListener = (res) => {
|
|
815
|
+
pageNotFoundCallbackManager.trigger(res);
|
|
816
|
+
};
|
|
817
|
+
const errorListener = (res) => {
|
|
818
|
+
// @ts-ignore
|
|
819
|
+
errorCallbackManager.trigger(res.stack || res.message || res);
|
|
820
|
+
};
|
|
865
821
|
const getApp$1 = () => {
|
|
866
822
|
var _a;
|
|
867
|
-
const path = (_a =
|
|
823
|
+
const path = (_a = Taro.Current.page) === null || _a === void 0 ? void 0 : _a.path;
|
|
868
824
|
return {
|
|
869
825
|
/** 小程序切前台的路径 */
|
|
870
|
-
path: path === null || path === void 0 ? void 0 : path.substring(0, path.indexOf('?')),
|
|
826
|
+
path: (path === null || path === void 0 ? void 0 : path.substring(0, path.indexOf('?'))) || '',
|
|
871
827
|
/** 小程序切前台的 query 参数 */
|
|
872
828
|
query: queryString.parse(location.search),
|
|
873
829
|
/** 来源信息。 */
|
|
@@ -889,10 +845,33 @@ const appHideListener = () => {
|
|
|
889
845
|
}
|
|
890
846
|
};
|
|
891
847
|
// 应用级事件
|
|
892
|
-
const onUnhandledRejection =
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
848
|
+
const onUnhandledRejection = callback => {
|
|
849
|
+
unhandledRejectionCallbackManager.add(callback);
|
|
850
|
+
if (unhandledRejectionCallbackManager.count() === 1) {
|
|
851
|
+
window.addEventListener('unhandledrejection', unhandledRejectionListener);
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
const onThemeChange = callback => {
|
|
855
|
+
themeChangeCallbackManager.add(callback);
|
|
856
|
+
if (themeChangeCallbackManager.count() === 1) {
|
|
857
|
+
if (lodashEs.isNil(themeMatchMedia)) {
|
|
858
|
+
themeMatchMedia = window.matchMedia('(prefers-color-scheme: light)');
|
|
859
|
+
}
|
|
860
|
+
themeMatchMedia.addEventListener('change', themeChangeListener);
|
|
861
|
+
}
|
|
862
|
+
};
|
|
863
|
+
const onPageNotFound = callback => {
|
|
864
|
+
pageNotFoundCallbackManager.add(callback);
|
|
865
|
+
if (pageNotFoundCallbackManager.count() === 1) {
|
|
866
|
+
Taro.eventCenter.on('__taroRouterNotFound', pageNotFoundListener);
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
const onError = callback => {
|
|
870
|
+
errorCallbackManager.add(callback);
|
|
871
|
+
if (errorCallbackManager.count() === 1) {
|
|
872
|
+
window.addEventListener('error', errorListener);
|
|
873
|
+
}
|
|
874
|
+
};
|
|
896
875
|
const onAudioInterruptionEnd = temporarilyNotSupport('onAudioInterruptionEnd');
|
|
897
876
|
const onAudioInterruptionBegin = temporarilyNotSupport('onAudioInterruptionBegin');
|
|
898
877
|
const onAppShow = callback => {
|
|
@@ -907,10 +886,34 @@ const onAppHide = callback => {
|
|
|
907
886
|
window.addEventListener('visibilitychange', appHideListener);
|
|
908
887
|
}
|
|
909
888
|
};
|
|
910
|
-
const offUnhandledRejection =
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
889
|
+
const offUnhandledRejection = callback => {
|
|
890
|
+
unhandledRejectionCallbackManager.remove(callback);
|
|
891
|
+
if (unhandledRejectionCallbackManager.count() === 0) {
|
|
892
|
+
window.removeEventListener('unhandledrejection', unhandledRejectionListener);
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
const offThemeChange = callback => {
|
|
896
|
+
themeChangeCallbackManager.remove(callback);
|
|
897
|
+
if (themeChangeCallbackManager.count() === 0) {
|
|
898
|
+
if (lodashEs.isNil(themeMatchMedia)) {
|
|
899
|
+
themeMatchMedia = window.matchMedia('(prefers-color-scheme: light)');
|
|
900
|
+
}
|
|
901
|
+
themeMatchMedia.removeEventListener('change', themeChangeListener);
|
|
902
|
+
themeMatchMedia = null;
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
const offPageNotFound = callback => {
|
|
906
|
+
pageNotFoundCallbackManager.remove(callback);
|
|
907
|
+
if (pageNotFoundCallbackManager.count() === 0) {
|
|
908
|
+
Taro.eventCenter.off('__taroRouterNotFound', pageNotFoundListener);
|
|
909
|
+
}
|
|
910
|
+
};
|
|
911
|
+
const offError = callback => {
|
|
912
|
+
errorCallbackManager.remove(callback);
|
|
913
|
+
if (errorCallbackManager.count() === 0) {
|
|
914
|
+
window.removeEventListener('error', errorListener);
|
|
915
|
+
}
|
|
916
|
+
};
|
|
914
917
|
const offAudioInterruptionEnd = temporarilyNotSupport('offAudioInterruptionEnd');
|
|
915
918
|
const offAudioInterruptionBegin = temporarilyNotSupport('offAudioInterruptionBegin');
|
|
916
919
|
const offAppShow = callback => {
|
|
@@ -936,7 +939,7 @@ const launchOptions = {
|
|
|
936
939
|
function initLaunchOptions(options = {}) {
|
|
937
940
|
Object.assign(launchOptions, options);
|
|
938
941
|
}
|
|
939
|
-
|
|
942
|
+
Taro.eventCenter.once('__taroRouterLaunch', initLaunchOptions);
|
|
940
943
|
// 生命周期
|
|
941
944
|
const getLaunchOptionsSync = () => launchOptions;
|
|
942
945
|
const getEnterOptionsSync = () => launchOptions;
|
|
@@ -947,7 +950,8 @@ const env = {
|
|
|
947
950
|
TARO_PLATFORM: process.env.TARO_PLATFORM,
|
|
948
951
|
TARO_VERSION: process.env.TARO_VERSION,
|
|
949
952
|
};
|
|
950
|
-
|
|
953
|
+
// Note: 该方法由 taro-plugin-platform-h5 实现
|
|
954
|
+
// export const canIUse = temporarilyNotSupport('canIUse')
|
|
951
955
|
function arrayBufferToBase64(arrayBuffer) {
|
|
952
956
|
return base64Js.fromByteArray(arrayBuffer);
|
|
953
957
|
}
|
|
@@ -1302,7 +1306,7 @@ const startAccelerometer = ({ interval = 'normal', success, fail, complete } = {
|
|
|
1302
1306
|
if (devicemotionListener) {
|
|
1303
1307
|
stopAccelerometer();
|
|
1304
1308
|
}
|
|
1305
|
-
devicemotionListener = throttle((evt) => {
|
|
1309
|
+
devicemotionListener = lodashEs.throttle((evt) => {
|
|
1306
1310
|
var _a, _b, _c;
|
|
1307
1311
|
callbackManager$3.trigger({
|
|
1308
1312
|
x: ((_a = evt.acceleration) === null || _a === void 0 ? void 0 : _a.x) || 0,
|
|
@@ -1659,7 +1663,7 @@ const startCompass = ({ success, fail, complete } = {}) => {
|
|
|
1659
1663
|
if (compassListener) {
|
|
1660
1664
|
stopCompass();
|
|
1661
1665
|
}
|
|
1662
|
-
compassListener = throttle((evt) => {
|
|
1666
|
+
compassListener = lodashEs.throttle((evt) => {
|
|
1663
1667
|
const isAndroid = getDeviceInfo().system === 'AndroidOS';
|
|
1664
1668
|
if (isAndroid && !evt.absolute && !CompassChangeTrigger) {
|
|
1665
1669
|
CompassChangeTrigger = true;
|
|
@@ -1773,7 +1777,7 @@ const startDeviceMotionListening = ({ interval = 'normal', success, fail, comple
|
|
|
1773
1777
|
if (deviceMotionListener) {
|
|
1774
1778
|
stopDeviceMotionListening();
|
|
1775
1779
|
}
|
|
1776
|
-
deviceMotionListener = throttle((evt) => {
|
|
1780
|
+
deviceMotionListener = lodashEs.throttle((evt) => {
|
|
1777
1781
|
callbackManager$1.trigger({
|
|
1778
1782
|
alpha: evt.alpha,
|
|
1779
1783
|
beta: evt.beta,
|
|
@@ -1992,10 +1996,10 @@ const getFileSystemManager = temporarilyNotSupport('getFileSystemManager');
|
|
|
1992
1996
|
const getFileInfo = temporarilyNotSupport('getFileInfo');
|
|
1993
1997
|
|
|
1994
1998
|
const getApp = function () {
|
|
1995
|
-
return
|
|
1999
|
+
return Taro.getCurrentInstance().app;
|
|
1996
2000
|
};
|
|
1997
2001
|
// 自定义组件
|
|
1998
|
-
const getCurrentInstance =
|
|
2002
|
+
const getCurrentInstance = Taro.getCurrentInstance;
|
|
1999
2003
|
|
|
2000
2004
|
const getLocationByW3CApi = (options) => {
|
|
2001
2005
|
var _a;
|
|
@@ -2248,7 +2252,7 @@ class InnerAudioContext {
|
|
|
2248
2252
|
this.Instance = new Audio();
|
|
2249
2253
|
this.errorStack = new CallbackManager();
|
|
2250
2254
|
this.stopStack = new CallbackManager();
|
|
2251
|
-
|
|
2255
|
+
Taro.eventCenter.on('__taroRouterChange', () => { this.stop(); });
|
|
2252
2256
|
this.onPlay(() => {
|
|
2253
2257
|
if (this.currentTime !== this.startTime) {
|
|
2254
2258
|
this.seek(this.startTime);
|
|
@@ -2933,8 +2937,8 @@ const offLocalServiceFound = temporarilyNotSupport('offLocalServiceFound');
|
|
|
2933
2937
|
const offLocalServiceDiscoveryStop = temporarilyNotSupport('offLocalServiceDiscoveryStop');
|
|
2934
2938
|
|
|
2935
2939
|
// @ts-ignore
|
|
2936
|
-
const { Link: Link$1 } =
|
|
2937
|
-
function generateRequestUrlWithParams(url, params) {
|
|
2940
|
+
const { Link: Link$1 } = Taro;
|
|
2941
|
+
function generateRequestUrlWithParams(url = '', params) {
|
|
2938
2942
|
params = typeof params === 'string' ? params : serializeParams(params);
|
|
2939
2943
|
if (params) {
|
|
2940
2944
|
url += (~url.indexOf('?') ? '&' : '?') + params;
|
|
@@ -2942,27 +2946,22 @@ function generateRequestUrlWithParams(url, params) {
|
|
|
2942
2946
|
url = url.replace('?&', '?');
|
|
2943
2947
|
return url;
|
|
2944
2948
|
}
|
|
2945
|
-
|
|
2946
|
-
function _request(options) {
|
|
2947
|
-
options = options || {};
|
|
2948
|
-
if (typeof options === 'string') {
|
|
2949
|
-
options = {
|
|
2950
|
-
url: options
|
|
2951
|
-
};
|
|
2952
|
-
}
|
|
2949
|
+
function _request(options = {}) {
|
|
2953
2950
|
const { success, complete, fail } = options;
|
|
2954
|
-
let url = options.url;
|
|
2951
|
+
let url = options.url || '';
|
|
2955
2952
|
const params = {};
|
|
2956
2953
|
const res = {};
|
|
2957
2954
|
if (options.jsonp) {
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2955
|
+
const { jsonp } = options, opts = __rest(options, ["jsonp"]);
|
|
2956
|
+
Object.assign(params, opts);
|
|
2957
|
+
// @ts-ignore
|
|
2958
|
+
params.params = opts.data;
|
|
2959
|
+
params.cache = opts.jsonpCache;
|
|
2960
|
+
if (typeof jsonp === 'string') {
|
|
2961
|
+
// @ts-ignore
|
|
2962
|
+
params.name = jsonp;
|
|
2963
2963
|
}
|
|
2964
|
-
|
|
2965
|
-
return jsonpRetry__default["default"](url, params)
|
|
2964
|
+
return jsonpRetry(url, params)
|
|
2966
2965
|
.then(data => {
|
|
2967
2966
|
res.statusCode = 200;
|
|
2968
2967
|
res.data = data;
|
|
@@ -3072,7 +3071,16 @@ function taroInterceptor(chain) {
|
|
|
3072
3071
|
return _request(chain.requestParams);
|
|
3073
3072
|
}
|
|
3074
3073
|
const link = new Link$1(taroInterceptor);
|
|
3075
|
-
const request =
|
|
3074
|
+
const request = ((...args) => {
|
|
3075
|
+
const [url = '', options = {}] = args;
|
|
3076
|
+
if (typeof url === 'string') {
|
|
3077
|
+
options.url = url;
|
|
3078
|
+
}
|
|
3079
|
+
else {
|
|
3080
|
+
Object.assign(options, url);
|
|
3081
|
+
}
|
|
3082
|
+
return link.request(options);
|
|
3083
|
+
});
|
|
3076
3084
|
const addInterceptor = link.addInterceptor.bind(link);
|
|
3077
3085
|
const cleanInterceptors = link.cleanInterceptors.bind(link);
|
|
3078
3086
|
|
|
@@ -3779,7 +3787,7 @@ const setBackgroundTextStyle = temporarilyNotSupport('setBackgroundTextStyle');
|
|
|
3779
3787
|
const setBackgroundColor = temporarilyNotSupport('setBackgroundColor');
|
|
3780
3788
|
|
|
3781
3789
|
// 自定义组件
|
|
3782
|
-
const nextTick =
|
|
3790
|
+
const nextTick = Taro.nextTick;
|
|
3783
3791
|
|
|
3784
3792
|
// 字体
|
|
3785
3793
|
const loadFontFace = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -4642,7 +4650,7 @@ const showActionSheet = (options = { itemList: [] }) => __awaiter(void 0, void 0
|
|
|
4642
4650
|
return handle.success(({ tapIndex: result }));
|
|
4643
4651
|
}
|
|
4644
4652
|
});
|
|
4645
|
-
|
|
4653
|
+
Taro.eventCenter.on('__afterTaroRouterChange', () => {
|
|
4646
4654
|
var _a, _b;
|
|
4647
4655
|
if (toast.currentPath && toast.currentPath !== ((_a = runtime.Current.page) === null || _a === void 0 ? void 0 : _a.path)) {
|
|
4648
4656
|
hideToast();
|
|
@@ -4703,7 +4711,7 @@ const hideHomeButton = temporarilyNotSupport('hideHomeButton');
|
|
|
4703
4711
|
const startPullDownRefresh = function ({ success, fail, complete } = {}) {
|
|
4704
4712
|
const handle = new MethodHandler({ name: 'startPullDownRefresh', success, fail, complete });
|
|
4705
4713
|
return new Promise((resolve, reject) => {
|
|
4706
|
-
|
|
4714
|
+
Taro.eventCenter.trigger('__taroStartPullDownRefresh', {
|
|
4707
4715
|
successHandler: (res = {}) => handle.success(res, { resolve, reject }),
|
|
4708
4716
|
errorHandler: (res = {}) => handle.fail(res, { resolve, reject })
|
|
4709
4717
|
});
|
|
@@ -4715,7 +4723,7 @@ const startPullDownRefresh = function ({ success, fail, complete } = {}) {
|
|
|
4715
4723
|
const stopPullDownRefresh = function ({ success, fail, complete } = {}) {
|
|
4716
4724
|
const handle = new MethodHandler({ name: 'stopPullDownRefresh', success, fail, complete });
|
|
4717
4725
|
return new Promise((resolve, reject) => {
|
|
4718
|
-
|
|
4726
|
+
Taro.eventCenter.trigger('__taroStopPullDownRefresh', {
|
|
4719
4727
|
successHandler: (res = {}) => handle.success(res, { resolve, reject }),
|
|
4720
4728
|
errorHandler: (res = {}) => handle.fail(res, { resolve, reject })
|
|
4721
4729
|
});
|
|
@@ -4833,7 +4841,7 @@ const showTabBarRedDot = (options) => {
|
|
|
4833
4841
|
});
|
|
4834
4842
|
}
|
|
4835
4843
|
return new Promise((resolve, reject) => {
|
|
4836
|
-
|
|
4844
|
+
Taro.eventCenter.trigger('__taroShowTabBarRedDotHandler', {
|
|
4837
4845
|
index,
|
|
4838
4846
|
successHandler: (res = {}) => handle.success(res, { resolve, reject }),
|
|
4839
4847
|
errorHandler: (res = {}) => handle.fail(res, { resolve, reject })
|
|
@@ -4863,7 +4871,7 @@ const showTabBar = (options = {}) => {
|
|
|
4863
4871
|
});
|
|
4864
4872
|
}
|
|
4865
4873
|
return new Promise((resolve, reject) => {
|
|
4866
|
-
|
|
4874
|
+
Taro.eventCenter.trigger('__taroShowTabBar', {
|
|
4867
4875
|
animation,
|
|
4868
4876
|
successHandler: (res = {}) => handle.success(res, { resolve, reject }),
|
|
4869
4877
|
errorHandler: (res = {}) => handle.fail(res, { resolve, reject })
|
|
@@ -4912,7 +4920,7 @@ const setTabBarStyle = (options = {}) => {
|
|
|
4912
4920
|
if (borderStyle)
|
|
4913
4921
|
obj.borderStyle = borderStyle;
|
|
4914
4922
|
return new Promise((resolve, reject) => {
|
|
4915
|
-
|
|
4923
|
+
Taro.eventCenter.trigger('__taroSetTabBarStyle', {
|
|
4916
4924
|
color,
|
|
4917
4925
|
selectedColor,
|
|
4918
4926
|
backgroundColor,
|
|
@@ -4945,7 +4953,7 @@ const setTabBarItem = (options) => {
|
|
|
4945
4953
|
});
|
|
4946
4954
|
}
|
|
4947
4955
|
return new Promise((resolve, reject) => {
|
|
4948
|
-
|
|
4956
|
+
Taro.eventCenter.trigger('__taroSetTabBarItem', {
|
|
4949
4957
|
index,
|
|
4950
4958
|
text,
|
|
4951
4959
|
iconPath,
|
|
@@ -4987,7 +4995,7 @@ const setTabBarBadge = (options) => {
|
|
|
4987
4995
|
});
|
|
4988
4996
|
}
|
|
4989
4997
|
return new Promise((resolve, reject) => {
|
|
4990
|
-
|
|
4998
|
+
Taro.eventCenter.trigger('__taroSetTabBarBadge', {
|
|
4991
4999
|
index,
|
|
4992
5000
|
text,
|
|
4993
5001
|
successHandler: (res = {}) => handle.success(res, { resolve, reject }),
|
|
@@ -5018,7 +5026,7 @@ const removeTabBarBadge = (options) => {
|
|
|
5018
5026
|
});
|
|
5019
5027
|
}
|
|
5020
5028
|
return new Promise((resolve, reject) => {
|
|
5021
|
-
|
|
5029
|
+
Taro.eventCenter.trigger('__taroRemoveTabBarBadge', {
|
|
5022
5030
|
index,
|
|
5023
5031
|
successHandler: (res = {}) => handle.success(res, { resolve, reject }),
|
|
5024
5032
|
errorHandler: (res = {}) => handle.fail(res, { resolve, reject })
|
|
@@ -5048,7 +5056,7 @@ const hideTabBarRedDot = (options) => {
|
|
|
5048
5056
|
});
|
|
5049
5057
|
}
|
|
5050
5058
|
return new Promise((resolve, reject) => {
|
|
5051
|
-
|
|
5059
|
+
Taro.eventCenter.trigger('__taroHideTabBarRedDotHandler', {
|
|
5052
5060
|
index,
|
|
5053
5061
|
successHandler: (res = {}) => handle.success(res, { resolve, reject }),
|
|
5054
5062
|
errorHandler: (res = {}) => handle.fail(res, { resolve, reject })
|
|
@@ -5078,7 +5086,7 @@ const hideTabBar = (options = {}) => {
|
|
|
5078
5086
|
});
|
|
5079
5087
|
}
|
|
5080
5088
|
return new Promise((resolve, reject) => {
|
|
5081
|
-
|
|
5089
|
+
Taro.eventCenter.trigger('__taroHideTabBar', {
|
|
5082
5090
|
animation,
|
|
5083
5091
|
successHandler: (res = {}) => handle.success(res, { resolve, reject }),
|
|
5084
5092
|
errorHandler: (res = {}) => handle.fail(res, { resolve, reject })
|
|
@@ -5120,7 +5128,7 @@ const offWindowResize = callback => {
|
|
|
5120
5128
|
const createWorker = temporarilyNotSupport('createWorker');
|
|
5121
5129
|
|
|
5122
5130
|
// pollify
|
|
5123
|
-
|
|
5131
|
+
import('intersection-observer');
|
|
5124
5132
|
class TaroH5IntersectionObserver {
|
|
5125
5133
|
// selector 的容器节点
|
|
5126
5134
|
get container() {
|
|
@@ -5531,7 +5539,7 @@ const createMediaQueryObserver = () => {
|
|
|
5531
5539
|
return new MediaQueryObserver();
|
|
5532
5540
|
};
|
|
5533
5541
|
|
|
5534
|
-
const { Behavior, getEnv, ENV_TYPE, Link, interceptors, interceptorify, Current, options, eventCenter, Events, preload } =
|
|
5542
|
+
const { Behavior, getEnv, ENV_TYPE, Link, interceptors, interceptorify, Current, options, eventCenter, Events, preload } = Taro;
|
|
5535
5543
|
const taro = {
|
|
5536
5544
|
// @ts-ignore
|
|
5537
5545
|
Behavior,
|
|
@@ -5668,7 +5676,6 @@ exports.authPrivateMessage = authPrivateMessage;
|
|
|
5668
5676
|
exports.authorize = authorize;
|
|
5669
5677
|
exports.authorizeForMiniProgram = authorizeForMiniProgram;
|
|
5670
5678
|
exports.base64ToArrayBuffer = base64ToArrayBuffer;
|
|
5671
|
-
exports.canIUse = canIUse;
|
|
5672
5679
|
exports.canIUseWebp = canIUseWebp;
|
|
5673
5680
|
exports.canvasGetImageData = canvasGetImageData;
|
|
5674
5681
|
exports.canvasPutImageData = canvasPutImageData;
|
|
@@ -5729,7 +5736,7 @@ exports.createVideoContext = createVideoContext;
|
|
|
5729
5736
|
exports.createVideoDecoder = createVideoDecoder;
|
|
5730
5737
|
exports.createWebAudioContext = createWebAudioContext;
|
|
5731
5738
|
exports.createWorker = createWorker;
|
|
5732
|
-
exports
|
|
5739
|
+
exports.default = taro;
|
|
5733
5740
|
exports.disableAlertBeforeUnload = disableAlertBeforeUnload;
|
|
5734
5741
|
exports.dishClassify = dishClassify;
|
|
5735
5742
|
exports.downloadFile = downloadFile;
|