@tarojs/taro-h5 3.4.6 → 3.5.0-alpha.1
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/system.js +28 -24
- package/dist/api/canvas/CanvasContext.js +27 -16
- package/dist/api/device/accelerometer.js +9 -17
- package/dist/api/device/battery.js +12 -3
- package/dist/api/device/clipboard.js +13 -4
- package/dist/api/device/compass.js +32 -18
- package/dist/api/device/motion.js +8 -17
- package/dist/api/device/network.js +12 -3
- package/dist/api/device/scan.js +8 -4
- package/dist/api/location/chooseLocation.js +13 -8
- package/dist/api/location/getLocation.js +64 -0
- package/dist/api/location/index.js +6 -3
- package/dist/api/media/image/previewImage.js +12 -3
- package/dist/api/taro.js +2 -3
- package/dist/api/ui/fonts.js +12 -3
- package/dist/api/ui/interaction/actionSheet.js +3 -12
- package/dist/api/ui/interaction/index.js +17 -8
- package/dist/api/ui/interaction/modal.js +6 -27
- package/dist/api/ui/interaction/toast.js +14 -40
- package/dist/api/utils/animation.js +14 -0
- package/dist/api/utils/index.js +33 -46
- package/dist/api/utils/lodash.js +29 -0
- package/dist/api/utils/valid.js +7 -0
- package/dist/dist/api/device/scan.d.ts +3 -1
- package/dist/dist/api/location/getLocation.d.ts +2 -0
- package/dist/dist/api/location/index.d.ts +5 -3
- package/dist/dist/api/taro.d.ts +2 -2
- package/dist/dist/api/utils/animation.d.ts +6 -0
- package/dist/dist/api/utils/index.d.ts +11 -10
- package/dist/dist/api/utils/lodash.d.ts +2 -0
- package/dist/dist/api/utils/valid.d.ts +2 -0
- package/dist/index.cjs.js +529 -260
- package/dist/index.cjs.js.map +1 -1
- package/package.json +11 -12
- package/src/api/device/accelerometer.ts +8 -17
- package/src/api/device/compass.ts +34 -18
- package/src/api/device/motion.ts +9 -17
- package/src/api/device/scan.ts +8 -4
- package/src/api/location/getLocation.ts +80 -0
- package/src/api/location/index.ts +6 -3
- package/src/api/taro.ts +2 -7
- package/src/api/ui/scroll/index.ts +1 -1
- package/src/api/utils/animation.ts +15 -0
- package/src/api/utils/index.ts +40 -46
- package/src/api/utils/lodash.ts +30 -0
- package/src/api/utils/valid.ts +8 -0
|
@@ -57,10 +57,7 @@ export default class ActionSheet {
|
|
|
57
57
|
// style
|
|
58
58
|
const { maskStyle, actionSheetStyle, menuStyle, cellStyle, cancelStyle } = this.style;
|
|
59
59
|
// configuration
|
|
60
|
-
const config = {
|
|
61
|
-
...this.options,
|
|
62
|
-
...options
|
|
63
|
-
};
|
|
60
|
+
const config = Object.assign(Object.assign({}, this.options), options);
|
|
64
61
|
this.lastConfig = config;
|
|
65
62
|
// wrapper
|
|
66
63
|
this.el = document.createElement('div');
|
|
@@ -75,10 +72,7 @@ export default class ActionSheet {
|
|
|
75
72
|
this.actionSheet.setAttribute('style', inlineStyle(actionSheetStyle));
|
|
76
73
|
// menu
|
|
77
74
|
this.menu = document.createElement('div');
|
|
78
|
-
this.menu.setAttribute('style', inlineStyle({
|
|
79
|
-
...menuStyle,
|
|
80
|
-
color: config.itemColor
|
|
81
|
-
}));
|
|
75
|
+
this.menu.setAttribute('style', inlineStyle(Object.assign(Object.assign({}, menuStyle), { color: config.itemColor })));
|
|
82
76
|
// cells
|
|
83
77
|
this.cells = config.itemList.map((item, index) => {
|
|
84
78
|
const cell = document.createElement('div');
|
|
@@ -121,10 +115,7 @@ export default class ActionSheet {
|
|
|
121
115
|
}
|
|
122
116
|
show(options = {}) {
|
|
123
117
|
return new Promise((resolve) => {
|
|
124
|
-
const config = {
|
|
125
|
-
...this.options,
|
|
126
|
-
...options
|
|
127
|
-
};
|
|
118
|
+
const config = Object.assign(Object.assign({}, this.options), options);
|
|
128
119
|
this.lastConfig = config;
|
|
129
120
|
if (this.hideOpacityTimer)
|
|
130
121
|
clearTimeout(this.hideOpacityTimer);
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import Taro from '@tarojs/api';
|
|
2
11
|
import { getParameterError, temporarilyNotSupport } from '../../utils';
|
|
3
12
|
import { MethodHandler } from '../../utils/handler';
|
|
@@ -106,7 +115,7 @@ const hideLoading = ({ success, fail, complete } = {}) => {
|
|
|
106
115
|
toast.hide(0, 'loading');
|
|
107
116
|
return handle.success();
|
|
108
117
|
};
|
|
109
|
-
const showModal =
|
|
118
|
+
const showModal = (options = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
110
119
|
init(document);
|
|
111
120
|
options = Object.assign({
|
|
112
121
|
title: '',
|
|
@@ -186,21 +195,21 @@ const showModal = async (options = {}) => {
|
|
|
186
195
|
options.showCancel = !!options.showCancel;
|
|
187
196
|
let result = '';
|
|
188
197
|
if (!modal.el) {
|
|
189
|
-
result =
|
|
198
|
+
result = yield modal.create(options);
|
|
190
199
|
}
|
|
191
200
|
else {
|
|
192
|
-
result =
|
|
201
|
+
result = yield modal.show(options);
|
|
193
202
|
}
|
|
194
203
|
const res = { cancel: !1, confirm: !1 };
|
|
195
204
|
res[result] = !0;
|
|
196
205
|
return handle.success(res);
|
|
197
|
-
};
|
|
206
|
+
});
|
|
198
207
|
function hideModal() {
|
|
199
208
|
if (!modal.el)
|
|
200
209
|
return;
|
|
201
210
|
modal.hide();
|
|
202
211
|
}
|
|
203
|
-
const showActionSheet =
|
|
212
|
+
const showActionSheet = (options = { itemList: [] }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
204
213
|
init(document);
|
|
205
214
|
options = Object.assign({
|
|
206
215
|
itemColor: '#000000',
|
|
@@ -246,10 +255,10 @@ const showActionSheet = async (options = { itemList: [] }) => {
|
|
|
246
255
|
}
|
|
247
256
|
let result = '';
|
|
248
257
|
if (!actionSheet.el) {
|
|
249
|
-
result =
|
|
258
|
+
result = yield actionSheet.create(options);
|
|
250
259
|
}
|
|
251
260
|
else {
|
|
252
|
-
result =
|
|
261
|
+
result = yield actionSheet.show(options);
|
|
253
262
|
}
|
|
254
263
|
if (typeof result === 'string') {
|
|
255
264
|
return handle.fail(({ errMsg: result }));
|
|
@@ -257,7 +266,7 @@ const showActionSheet = async (options = { itemList: [] }) => {
|
|
|
257
266
|
else {
|
|
258
267
|
return handle.success(({ tapIndex: result }));
|
|
259
268
|
}
|
|
260
|
-
};
|
|
269
|
+
});
|
|
261
270
|
Taro.eventCenter.on('__taroRouterChange', () => {
|
|
262
271
|
hideToast();
|
|
263
272
|
hideLoading();
|
|
@@ -64,10 +64,7 @@ export default class Modal {
|
|
|
64
64
|
// style
|
|
65
65
|
const { maskStyle, modalStyle, titleStyle, textStyle, footStyle, btnStyle } = this.style;
|
|
66
66
|
// configuration
|
|
67
|
-
const config = {
|
|
68
|
-
...this.options,
|
|
69
|
-
...options
|
|
70
|
-
};
|
|
67
|
+
const config = Object.assign(Object.assign({}, this.options), options);
|
|
71
68
|
// wrapper
|
|
72
69
|
this.el = document.createElement('div');
|
|
73
70
|
this.el.className = 'taro__modal';
|
|
@@ -82,20 +79,13 @@ export default class Modal {
|
|
|
82
79
|
modal.className = 'taro-modal__content';
|
|
83
80
|
modal.setAttribute('style', inlineStyle(modalStyle));
|
|
84
81
|
// title
|
|
85
|
-
const titleCSS = config.title ? titleStyle : {
|
|
86
|
-
...titleStyle,
|
|
87
|
-
display: 'none'
|
|
88
|
-
};
|
|
82
|
+
const titleCSS = config.title ? titleStyle : Object.assign(Object.assign({}, titleStyle), { display: 'none' });
|
|
89
83
|
this.title = document.createElement('div');
|
|
90
84
|
this.title.className = 'taro-modal__title';
|
|
91
85
|
this.title.setAttribute('style', inlineStyle(titleCSS));
|
|
92
86
|
this.title.textContent = config.title;
|
|
93
87
|
// text
|
|
94
|
-
const textCSS = config.title ? textStyle : {
|
|
95
|
-
...textStyle,
|
|
96
|
-
padding: '40px 20px 26px',
|
|
97
|
-
color: '#353535'
|
|
98
|
-
};
|
|
88
|
+
const textCSS = config.title ? textStyle : Object.assign(Object.assign({}, textStyle), { padding: '40px 20px 26px', color: '#353535' });
|
|
99
89
|
this.text = document.createElement('div');
|
|
100
90
|
this.text.className = 'taro-modal__text';
|
|
101
91
|
this.text.setAttribute('style', inlineStyle(textCSS));
|
|
@@ -105,11 +95,7 @@ export default class Modal {
|
|
|
105
95
|
foot.className = 'taro-modal__foot';
|
|
106
96
|
foot.setAttribute('style', inlineStyle(footStyle));
|
|
107
97
|
// cancel button
|
|
108
|
-
const cancelCSS = {
|
|
109
|
-
...btnStyle,
|
|
110
|
-
color: config.cancelColor,
|
|
111
|
-
display: config.showCancel ? 'block' : 'none'
|
|
112
|
-
};
|
|
98
|
+
const cancelCSS = Object.assign(Object.assign({}, btnStyle), { color: config.cancelColor, display: config.showCancel ? 'block' : 'none' });
|
|
113
99
|
this.cancel = document.createElement('div');
|
|
114
100
|
this.cancel.className = 'taro-model__btn taro-model__cancel';
|
|
115
101
|
this.cancel.setAttribute('style', inlineStyle(cancelCSS));
|
|
@@ -143,10 +129,7 @@ export default class Modal {
|
|
|
143
129
|
}
|
|
144
130
|
show(options = {}) {
|
|
145
131
|
return new Promise((resolve) => {
|
|
146
|
-
const config = {
|
|
147
|
-
...this.options,
|
|
148
|
-
...options
|
|
149
|
-
};
|
|
132
|
+
const config = Object.assign(Object.assign({}, this.options), options);
|
|
150
133
|
if (this.hideOpacityTimer)
|
|
151
134
|
clearTimeout(this.hideOpacityTimer);
|
|
152
135
|
if (this.hideDisplayTimer)
|
|
@@ -162,11 +145,7 @@ export default class Modal {
|
|
|
162
145
|
else {
|
|
163
146
|
// block => none
|
|
164
147
|
this.title.style.display = 'none';
|
|
165
|
-
const textCSS = {
|
|
166
|
-
...textStyle,
|
|
167
|
-
padding: '40px 20px 26px',
|
|
168
|
-
color: '#353535'
|
|
169
|
-
};
|
|
148
|
+
const textCSS = Object.assign(Object.assign({}, textStyle), { padding: '40px 20px 26px', color: '#353535' });
|
|
170
149
|
this.text.setAttribute('style', inlineStyle(textCSS));
|
|
171
150
|
}
|
|
172
151
|
this.text.textContent = config.content || '';
|
|
@@ -78,11 +78,7 @@ export default class Toast {
|
|
|
78
78
|
// style
|
|
79
79
|
const { maskStyle, toastStyle, successStyle, errrorStyle, loadingStyle, imageStyle, textStyle } = this.style;
|
|
80
80
|
// configuration
|
|
81
|
-
const config = {
|
|
82
|
-
...this.options,
|
|
83
|
-
...options,
|
|
84
|
-
_type
|
|
85
|
-
};
|
|
81
|
+
const config = Object.assign(Object.assign(Object.assign({}, this.options), options), { _type });
|
|
86
82
|
// wrapper
|
|
87
83
|
this.el = document.createElement('div');
|
|
88
84
|
this.el.className = 'taro__toast';
|
|
@@ -95,27 +91,18 @@ export default class Toast {
|
|
|
95
91
|
// icon
|
|
96
92
|
this.icon = document.createElement('p');
|
|
97
93
|
if (config.image) {
|
|
98
|
-
this.icon.setAttribute('style', inlineStyle({
|
|
99
|
-
...imageStyle,
|
|
100
|
-
'background-image': `url(${config.image})`
|
|
101
|
-
}));
|
|
94
|
+
this.icon.setAttribute('style', inlineStyle(Object.assign(Object.assign({}, imageStyle), { 'background-image': `url(${config.image})` })));
|
|
102
95
|
}
|
|
103
96
|
else {
|
|
104
97
|
const iconStyle = config.icon === 'loading' ? loadingStyle : config.icon === 'error' ? errrorStyle : successStyle;
|
|
105
|
-
this.icon.setAttribute('style', inlineStyle({
|
|
106
|
-
...iconStyle,
|
|
107
|
-
...(config.icon === 'none' ? { display: 'none' } : {})
|
|
108
|
-
}));
|
|
98
|
+
this.icon.setAttribute('style', inlineStyle(Object.assign(Object.assign({}, iconStyle), (config.icon === 'none' ? { display: 'none' } : {}))));
|
|
109
99
|
}
|
|
110
100
|
// toast
|
|
111
101
|
this.toast = document.createElement('div');
|
|
112
|
-
this.toast.setAttribute('style', inlineStyle({
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
padding: '10px 15px'
|
|
117
|
-
} : {})
|
|
118
|
-
}));
|
|
102
|
+
this.toast.setAttribute('style', inlineStyle(Object.assign(Object.assign({}, toastStyle), (config.icon === 'none' ? {
|
|
103
|
+
'min-height': '0',
|
|
104
|
+
padding: '10px 15px'
|
|
105
|
+
} : {}))));
|
|
119
106
|
// title
|
|
120
107
|
this.title = document.createElement('p');
|
|
121
108
|
this.title.setAttribute('style', inlineStyle(textStyle));
|
|
@@ -134,11 +121,7 @@ export default class Toast {
|
|
|
134
121
|
return '';
|
|
135
122
|
}
|
|
136
123
|
show(options = {}, _type = 'toast') {
|
|
137
|
-
const config = {
|
|
138
|
-
...this.options,
|
|
139
|
-
...options,
|
|
140
|
-
_type
|
|
141
|
-
};
|
|
124
|
+
const config = Object.assign(Object.assign(Object.assign({}, this.options), options), { _type });
|
|
142
125
|
if (this.hideOpacityTimer)
|
|
143
126
|
clearTimeout(this.hideOpacityTimer);
|
|
144
127
|
if (this.hideDisplayTimer)
|
|
@@ -150,28 +133,19 @@ export default class Toast {
|
|
|
150
133
|
// image
|
|
151
134
|
const { toastStyle, successStyle, errrorStyle, loadingStyle, imageStyle } = this.style;
|
|
152
135
|
if (config.image) {
|
|
153
|
-
this.icon.setAttribute('style', inlineStyle({
|
|
154
|
-
...imageStyle,
|
|
155
|
-
'background-image': `url(${config.image})`
|
|
156
|
-
}));
|
|
136
|
+
this.icon.setAttribute('style', inlineStyle(Object.assign(Object.assign({}, imageStyle), { 'background-image': `url(${config.image})` })));
|
|
157
137
|
}
|
|
158
138
|
else {
|
|
159
139
|
if (!config.image && config.icon) {
|
|
160
140
|
const iconStyle = config.icon === 'loading' ? loadingStyle : config.icon === 'error' ? errrorStyle : successStyle;
|
|
161
|
-
this.icon.setAttribute('style', inlineStyle({
|
|
162
|
-
...iconStyle,
|
|
163
|
-
...(config.icon === 'none' ? { display: 'none' } : {})
|
|
164
|
-
}));
|
|
141
|
+
this.icon.setAttribute('style', inlineStyle(Object.assign(Object.assign({}, iconStyle), (config.icon === 'none' ? { display: 'none' } : {}))));
|
|
165
142
|
}
|
|
166
143
|
}
|
|
167
144
|
// toast
|
|
168
|
-
this.toast.setAttribute('style', inlineStyle({
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
padding: '10px 15px'
|
|
173
|
-
} : {})
|
|
174
|
-
}));
|
|
145
|
+
this.toast.setAttribute('style', inlineStyle(Object.assign(Object.assign({}, toastStyle), (config.icon === 'none' ? {
|
|
146
|
+
'min-height': '0',
|
|
147
|
+
padding: '10px 15px'
|
|
148
|
+
} : {}))));
|
|
175
149
|
// show
|
|
176
150
|
this.el.style.display = 'block';
|
|
177
151
|
setTimeout(() => { this.el.style.opacity = '1'; }, 0);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ease-in-out的函数
|
|
3
|
+
* @param t 0-1的数字
|
|
4
|
+
*/
|
|
5
|
+
export const easeInOut = (t) => (t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1);
|
|
6
|
+
export const getTimingFunc = (easeFunc, frameCnt) => {
|
|
7
|
+
return x => {
|
|
8
|
+
if (frameCnt <= 1) {
|
|
9
|
+
return easeFunc(1);
|
|
10
|
+
}
|
|
11
|
+
const t = x / (frameCnt - 1);
|
|
12
|
+
return easeFunc(t);
|
|
13
|
+
};
|
|
14
|
+
};
|
package/dist/api/utils/index.js
CHANGED
|
@@ -90,7 +90,7 @@ export function temporarilyNotSupport(apiName) {
|
|
|
90
90
|
}
|
|
91
91
|
export function weixinCorpSupport(apiName) {
|
|
92
92
|
return () => {
|
|
93
|
-
const errMsg = `h5
|
|
93
|
+
const errMsg = `h5端当前仅在微信公众号JS-SDK环境下支持此 API ${apiName}`;
|
|
94
94
|
if (process.env.NODE_ENV !== 'production') {
|
|
95
95
|
console.error(errMsg);
|
|
96
96
|
return Promise.reject({
|
|
@@ -122,51 +122,38 @@ export function permanentlyNotSupport(apiName) {
|
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
-
export function
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
else if (k === 'fail') {
|
|
149
|
-
reject(res);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
125
|
+
export function processOpenApi({ name, defaultOptions, standardMethod, formatOptions = options => options, formatResult = res => res }) {
|
|
126
|
+
const notSupported = weixinCorpSupport(name);
|
|
127
|
+
return (options = {}) => {
|
|
128
|
+
var _a;
|
|
129
|
+
// @ts-ignore
|
|
130
|
+
const targetApi = (_a = window === null || window === void 0 ? void 0 : window.wx) === null || _a === void 0 ? void 0 : _a[name];
|
|
131
|
+
const opts = formatOptions(Object.assign({}, defaultOptions, options));
|
|
132
|
+
if (typeof targetApi === 'function') {
|
|
133
|
+
return new Promise((resolve, reject) => {
|
|
134
|
+
['fail', 'success', 'complete'].forEach(k => {
|
|
135
|
+
opts[k] = preRef => {
|
|
136
|
+
const res = formatResult(preRef);
|
|
137
|
+
options[k] && options[k](res);
|
|
138
|
+
if (k === 'success') {
|
|
139
|
+
resolve(res);
|
|
140
|
+
}
|
|
141
|
+
else if (k === 'fail') {
|
|
142
|
+
reject(res);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
return targetApi(opts);
|
|
146
|
+
});
|
|
152
147
|
});
|
|
153
|
-
// @ts-ignore
|
|
154
|
-
wx[apiName](formatParams(obj));
|
|
155
|
-
});
|
|
156
|
-
return p;
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* ease-in-out的函数
|
|
161
|
-
* @param t 0-1的数字
|
|
162
|
-
*/
|
|
163
|
-
export const easeInOut = (t) => t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
|
|
164
|
-
export const getTimingFunc = (easeFunc, frameCnt) => {
|
|
165
|
-
return x => {
|
|
166
|
-
if (frameCnt <= 1) {
|
|
167
|
-
return easeFunc(1);
|
|
168
148
|
}
|
|
169
|
-
|
|
170
|
-
|
|
149
|
+
else if (typeof standardMethod === 'function') {
|
|
150
|
+
return standardMethod(opts);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
return notSupported();
|
|
154
|
+
}
|
|
171
155
|
};
|
|
172
|
-
}
|
|
156
|
+
}
|
|
157
|
+
export * from './animation';
|
|
158
|
+
export * from './lodash';
|
|
159
|
+
export * from './valid';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function throttle(fn, threshold = 250, scope) {
|
|
2
|
+
let lastTime = 0;
|
|
3
|
+
let deferTimer;
|
|
4
|
+
return function (...args) {
|
|
5
|
+
const context = scope || this;
|
|
6
|
+
const now = Date.now();
|
|
7
|
+
if (now - lastTime > threshold) {
|
|
8
|
+
fn.apply(this, args);
|
|
9
|
+
lastTime = now;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
clearTimeout(deferTimer);
|
|
13
|
+
deferTimer = setTimeout(() => {
|
|
14
|
+
lastTime = now;
|
|
15
|
+
fn.apply(context, args);
|
|
16
|
+
}, threshold);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function debounce(fn, ms = 250, scope) {
|
|
21
|
+
let timer;
|
|
22
|
+
return function (...args) {
|
|
23
|
+
const context = scope || this;
|
|
24
|
+
clearTimeout(timer);
|
|
25
|
+
timer = setTimeout(function () {
|
|
26
|
+
fn.apply(context, args);
|
|
27
|
+
}, ms);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -7,7 +7,9 @@ export declare const startLocationUpdateBackground: () => Promise<{
|
|
|
7
7
|
export declare const startLocationUpdate: () => Promise<{
|
|
8
8
|
errMsg: string;
|
|
9
9
|
}>;
|
|
10
|
-
export declare const openLocation: (options
|
|
10
|
+
export declare const openLocation: (options?: Partial<{
|
|
11
|
+
scale: number;
|
|
12
|
+
}>) => Promise<any>;
|
|
11
13
|
export declare const onLocationChangeError: () => Promise<{
|
|
12
14
|
errMsg: string;
|
|
13
15
|
}>;
|
|
@@ -20,8 +22,8 @@ export declare const offLocationChangeError: () => Promise<{
|
|
|
20
22
|
export declare const offLocationChange: () => Promise<{
|
|
21
23
|
errMsg: string;
|
|
22
24
|
}>;
|
|
23
|
-
export
|
|
25
|
+
export { getLocation } from './getLocation';
|
|
24
26
|
export declare const choosePoi: () => Promise<{
|
|
25
27
|
errMsg: string;
|
|
26
28
|
}>;
|
|
27
|
-
export
|
|
29
|
+
export { chooseLocation } from './chooseLocation';
|
package/dist/dist/api/taro.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Taro from '@tarojs/api';
|
|
2
|
-
import { history
|
|
2
|
+
import { history } from '@tarojs/router';
|
|
3
3
|
declare const Behavior: any, getEnv: any, ENV_TYPE: any, Link: any, interceptors: any, Current: any, options: any, eventCenter: any, Events: any, preload: any;
|
|
4
4
|
declare const taro: typeof Taro;
|
|
5
5
|
declare const initPxTransform: any;
|
|
@@ -9,4 +9,4 @@ declare const requirePlugin: () => Promise<{
|
|
|
9
9
|
declare const pxTransform: (size: any) => string;
|
|
10
10
|
declare const canIUseWebp: () => boolean;
|
|
11
11
|
export default taro;
|
|
12
|
-
export { Behavior, getEnv, ENV_TYPE, Link, interceptors, initPxTransform, Current, options, eventCenter, Events, preload, requirePlugin, pxTransform, canIUseWebp, history
|
|
12
|
+
export { Behavior, getEnv, ENV_TYPE, Link, interceptors, initPxTransform, Current, options, eventCenter, Events, preload, requirePlugin, pxTransform, canIUseWebp, history };
|
|
@@ -26,13 +26,14 @@ export declare function weixinCorpSupport(apiName: any): () => Promise<{
|
|
|
26
26
|
export declare function permanentlyNotSupport(apiName: any): () => Promise<{
|
|
27
27
|
errMsg: string;
|
|
28
28
|
}>;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export declare
|
|
37
|
-
export
|
|
38
|
-
export
|
|
29
|
+
interface IProcessOpenApi<TOptions = Record<string, unknown>, TResult extends TaroGeneral.CallbackResult = any> {
|
|
30
|
+
name: string;
|
|
31
|
+
defaultOptions?: TOptions;
|
|
32
|
+
standardMethod?: (opts: TOptions) => Promise<TResult>;
|
|
33
|
+
formatOptions?: (opts: TOptions) => TOptions;
|
|
34
|
+
formatResult?: (res: TResult) => TResult;
|
|
35
|
+
}
|
|
36
|
+
export declare function processOpenApi<TOptions = Record<string, unknown>, TResult extends TaroGeneral.CallbackResult = any>({ name, defaultOptions, standardMethod, formatOptions, formatResult }: IProcessOpenApi<TOptions, TResult>): (options?: Partial<TOptions>) => Promise<TResult>;
|
|
37
|
+
export * from './animation';
|
|
38
|
+
export * from './lodash';
|
|
39
|
+
export * from './valid';
|