first commit
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
import { tryOnScopeDispose } from "@vueuse/core";
|
||||
|
||||
//#region ../../packages/hooks/use-timeout/index.ts
|
||||
function useTimeout() {
|
||||
let timeoutHandle;
|
||||
const registerTimeout = (fn, delay) => {
|
||||
cancelTimeout();
|
||||
timeoutHandle = window.setTimeout(fn, delay);
|
||||
};
|
||||
const cancelTimeout = () => window.clearTimeout(timeoutHandle);
|
||||
tryOnScopeDispose(() => cancelTimeout());
|
||||
return {
|
||||
registerTimeout,
|
||||
cancelTimeout
|
||||
};
|
||||
}
|
||||
|
||||
//#endregion
|
||||
export { useTimeout };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
Reference in New Issue
Block a user