You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
441 B
19 lines
441 B
import { tryOnScopeDispose } from '@vueuse/core';
|
|
|
|
function useTimeout() {
|
|
let timeoutHandle;
|
|
const registerTimeout = (fn, delay) => {
|
|
cancelTimeout();
|
|
timeoutHandle = window.setTimeout(fn, delay);
|
|
};
|
|
const cancelTimeout = () => window.clearTimeout(timeoutHandle);
|
|
tryOnScopeDispose(() => cancelTimeout());
|
|
return {
|
|
registerTimeout,
|
|
cancelTimeout
|
|
};
|
|
}
|
|
|
|
export { useTimeout };
|
|
//# sourceMappingURL=index.mjs.map
|