zzz-pc-view 0.0.171 → 0.0.172

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zzz-pc-view",
3
- "version": "0.0.171",
3
+ "version": "0.0.172",
4
4
  "main": "src/index.umd.js",
5
5
  "module": "src/index.es.js",
6
6
  "types": "src/index.d.ts",
package/src/index.es.js CHANGED
@@ -1997,11 +1997,33 @@ const useDebounce = (callback, wait = 300) => {
1997
1997
  }, wait);
1998
1998
  };
1999
1999
  };
2000
+ const useTimeout = (callback, wait) => {
2001
+ let timeout;
2002
+ const stopTimer = () => {
2003
+ if (timeout === void 0) {
2004
+ return;
2005
+ }
2006
+ clearTimeout(timeout);
2007
+ timeout = void 0;
2008
+ };
2009
+ const execTimer = (...args) => {
2010
+ stopTimer();
2011
+ timeout = setTimeout(() => {
2012
+ timeout = void 0;
2013
+ callback(...args);
2014
+ }, wait);
2015
+ };
2016
+ return {
2017
+ execTimer,
2018
+ stopTimer
2019
+ };
2020
+ };
2000
2021
  const index$d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2001
2022
  __proto__: null,
2002
2023
  useDebounce,
2003
2024
  useHttpRequestInterval,
2004
- useInterval
2025
+ useInterval,
2026
+ useTimeout
2005
2027
  }, Symbol.toStringTag, { value: "Module" }));
2006
2028
  const selectCtrlByAll = (param) => {
2007
2029
  const { keyProp } = param;