智慧水务管理系统 - 精河县供水工程综合管理平台

index.mjs 571B

1234567891011121314151617181920212223
  1. import { tryOnScopeDispose } from "@vueuse/core";
  2. //#region ../../packages/hooks/use-timeout/index.ts
  3. function useTimeout() {
  4. let timeoutHandle;
  5. const registerTimeout = (fn, delay) => {
  6. cancelTimeout();
  7. timeoutHandle = globalThis.setTimeout(fn, delay);
  8. };
  9. const cancelTimeout = () => {
  10. if (timeoutHandle === void 0) return;
  11. globalThis.clearTimeout(timeoutHandle);
  12. timeoutHandle = void 0;
  13. };
  14. tryOnScopeDispose(() => cancelTimeout());
  15. return {
  16. registerTimeout,
  17. cancelTimeout
  18. };
  19. }
  20. //#endregion
  21. export { useTimeout };
  22. //# sourceMappingURL=index.mjs.map