@tarojs/api 3.6.22-nightly.7 → 3.6.22-nightly.8

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.
@@ -1,81 +0,0 @@
1
- import { isFunction, isObject, isUndefined } from '@tarojs/shared';
2
-
3
- function handleObjectAssignPolyfill() {
4
- if (!isFunction(Object.assign)) {
5
- // Must be writable: true, enumerable: false, configurable: true
6
- Object.assign = function (target) {
7
- if (target == null) { // TypeError if undefined or null
8
- throw new TypeError('Cannot convert undefined or null to object');
9
- }
10
- const to = Object(target);
11
- for (let index = 1; index < arguments.length; index++) {
12
- const nextSource = arguments[index];
13
- if (nextSource != null) { // Skip over if undefined or null
14
- for (const nextKey in nextSource) {
15
- // Avoid bugs when hasOwnProperty is shadowed
16
- if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
17
- to[nextKey] = nextSource[nextKey];
18
- }
19
- }
20
- }
21
- }
22
- return to;
23
- };
24
- }
25
- }
26
- function handleObjectDefinePropertyPolyfill() {
27
- if (!isFunction(Object.defineProperties)) {
28
- Object.defineProperties = function (obj, properties) {
29
- function convertToDescriptor(desc) {
30
- function hasProperty(obj, prop) {
31
- return Object.prototype.hasOwnProperty.call(obj, prop);
32
- }
33
- if (!isObject(desc)) {
34
- throw new TypeError('bad desc');
35
- }
36
- const d = {};
37
- if (hasProperty(desc, 'enumerable'))
38
- d.enumerable = !!desc.enumerable;
39
- if (hasProperty(desc, 'configurable')) {
40
- d.configurable = !!desc.configurable;
41
- }
42
- if (hasProperty(desc, 'value'))
43
- d.value = desc.value;
44
- if (hasProperty(desc, 'writable'))
45
- d.writable = !!desc.writable;
46
- if (hasProperty(desc, 'get')) {
47
- const g = desc.get;
48
- if (!isFunction(g) && !isUndefined(g)) {
49
- throw new TypeError('bad get');
50
- }
51
- d.get = g;
52
- }
53
- if (hasProperty(desc, 'set')) {
54
- const s = desc.set;
55
- if (!isFunction(s) && !isUndefined(s)) {
56
- throw new TypeError('bad set');
57
- }
58
- d.set = s;
59
- }
60
- if (('get' in d || 'set' in d) && ('value' in d || 'writable' in d)) {
61
- throw new TypeError('identity-confused descriptor');
62
- }
63
- return d;
64
- }
65
- if (!isObject(obj))
66
- throw new TypeError('bad obj');
67
- properties = Object(properties);
68
- const keys = Object.keys(properties);
69
- const descs = [];
70
- for (let i = 0; i < keys.length; i++) {
71
- descs.push([keys[i], convertToDescriptor(properties[keys[i]])]);
72
- }
73
- for (let i = 0; i < descs.length; i++) {
74
- Object.defineProperty(obj, descs[i][0], descs[i][1]);
75
- }
76
- return obj;
77
- };
78
- }
79
- }
80
-
81
- export { handleObjectAssignPolyfill, handleObjectDefinePropertyPolyfill };
package/dist/utils.d.ts DELETED
@@ -1,2 +0,0 @@
1
- declare function throttle(fn: any, threshold?: number, scope?: any): (...args: any[]) => void;
2
- export { throttle };
package/dist/utils.js DELETED
@@ -1,21 +0,0 @@
1
- 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
-
21
- export { throttle };