@tarojs/runtime 4.0.0-beta.8 → 4.0.0-beta.81

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,2 +1,3 @@
1
1
  declare function throttle(fn: any, threshold?: number, scope?: any): (...args: any[]) => void;
2
- export { throttle };
2
+ declare function debounce(fn: any, ms?: number, scope?: any): (...args: any[]) => void;
3
+ export { throttle, debounce };
@@ -17,6 +17,16 @@ function throttle(fn, threshold = 250, scope) {
17
17
  }
18
18
  };
19
19
  }
20
+ 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
+ }
20
30
 
21
- export { throttle };
31
+ export { debounce, throttle };
22
32
  //# sourceMappingURL=lodash.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lodash.js","sources":["../../src/utils/lodash.ts"],"sourcesContent":["export function throttle (fn, threshold = 250, scope?) {\n let lastTime = 0\n let deferTimer: ReturnType<typeof setTimeout>\n return function (...args) {\n const context = scope || this\n const now = Date.now()\n if (now - lastTime > threshold) {\n fn.apply(this, args)\n lastTime = now\n } else {\n clearTimeout(deferTimer)\n deferTimer = setTimeout(() => {\n lastTime = now\n fn.apply(context, args)\n }, threshold)\n }\n }\n}\n"],"names":[],"mappings":"AAAM,SAAU,QAAQ,CAAE,EAAE,EAAE,SAAS,GAAG,GAAG,EAAE,KAAM,EAAA;IACnD,IAAI,QAAQ,GAAG,CAAC,CAAA;AAChB,IAAA,IAAI,UAAyC,CAAA;IAC7C,OAAO,UAAU,GAAG,IAAI,EAAA;AACtB,QAAA,MAAM,OAAO,GAAG,KAAK,IAAI,IAAI,CAAA;AAC7B,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;AACtB,QAAA,IAAI,GAAG,GAAG,QAAQ,GAAG,SAAS,EAAE;AAC9B,YAAA,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;YACpB,QAAQ,GAAG,GAAG,CAAA;AACf,SAAA;AAAM,aAAA;YACL,YAAY,CAAC,UAAU,CAAC,CAAA;AACxB,YAAA,UAAU,GAAG,UAAU,CAAC,MAAK;gBAC3B,QAAQ,GAAG,GAAG,CAAA;AACd,gBAAA,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;aACxB,EAAE,SAAS,CAAC,CAAA;AACd,SAAA;AACH,KAAC,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"lodash.js","sources":["../../src/utils/lodash.ts"],"sourcesContent":["export function throttle (fn, threshold = 250, scope?) {\n let lastTime = 0\n let deferTimer: ReturnType<typeof setTimeout>\n return function (...args) {\n const context = scope || this\n const now = Date.now()\n if (now - lastTime > threshold) {\n fn.apply(this, args)\n lastTime = now\n } else {\n clearTimeout(deferTimer)\n deferTimer = setTimeout(() => {\n lastTime = now\n fn.apply(context, args)\n }, threshold)\n }\n }\n}\n\nexport function debounce (fn, ms = 250, scope?) {\n let timer: ReturnType<typeof setTimeout>\n\n return function (...args) {\n const context = scope || this\n clearTimeout(timer)\n timer = setTimeout(function () {\n fn.apply(context, args)\n }, ms)\n }\n}\n"],"names":[],"mappings":"AAAM,SAAU,QAAQ,CAAE,EAAE,EAAE,SAAS,GAAG,GAAG,EAAE,KAAM,EAAA;IACnD,IAAI,QAAQ,GAAG,CAAC,CAAA;AAChB,IAAA,IAAI,UAAyC,CAAA;IAC7C,OAAO,UAAU,GAAG,IAAI,EAAA;AACtB,QAAA,MAAM,OAAO,GAAG,KAAK,IAAI,IAAI,CAAA;AAC7B,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;AACtB,QAAA,IAAI,GAAG,GAAG,QAAQ,GAAG,SAAS,EAAE;AAC9B,YAAA,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;YACpB,QAAQ,GAAG,GAAG,CAAA;AACf,SAAA;AAAM,aAAA;YACL,YAAY,CAAC,UAAU,CAAC,CAAA;AACxB,YAAA,UAAU,GAAG,UAAU,CAAC,MAAK;gBAC3B,QAAQ,GAAG,GAAG,CAAA;AACd,gBAAA,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;aACxB,EAAE,SAAS,CAAC,CAAA;AACd,SAAA;AACH,KAAC,CAAA;AACH,CAAC;AAEK,SAAU,QAAQ,CAAE,EAAE,EAAE,EAAE,GAAG,GAAG,EAAE,KAAM,EAAA;AAC5C,IAAA,IAAI,KAAoC,CAAA;IAExC,OAAO,UAAU,GAAG,IAAI,EAAA;AACtB,QAAA,MAAM,OAAO,GAAG,KAAK,IAAI,IAAI,CAAA;QAC7B,YAAY,CAAC,KAAK,CAAC,CAAA;QACnB,KAAK,GAAG,UAAU,CAAC,YAAA;AACjB,YAAA,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;SACxB,EAAE,EAAE,CAAC,CAAA;AACR,KAAC,CAAA;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/runtime",
3
- "version": "4.0.0-beta.8",
3
+ "version": "4.0.0-beta.81",
4
4
  "description": "taro runtime for mini apps.",
5
5
  "browser": "dist/index.js",
6
6
  "main:h5": "dist/runtime.esm.js",
@@ -35,10 +35,10 @@
35
35
  "rollup-plugin-ts": "^3.0.2",
36
36
  "ts-jest": "^29.0.5",
37
37
  "typescript": "^4.7.4",
38
- "@tarojs/shared": "4.0.0-beta.8"
38
+ "@tarojs/shared": "4.0.0-beta.81"
39
39
  },
40
40
  "peerDependencies": {
41
- "@tarojs/shared": "~4.0.0-beta.8"
41
+ "@tarojs/shared": "~4.0.0-beta.81"
42
42
  },
43
43
  "scripts": {
44
44
  "prebuild": "pnpm run clean",