paradiego

This commit is contained in:
2024-09-18 13:34:19 -03:00
commit 3f0e204289
12510 changed files with 1486101 additions and 0 deletions

2
node_modules/@mui/utils/modern/useTimeout/index.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export { default } from "./useTimeout.js";
export { Timeout } from "./useTimeout.js";

View File

@@ -0,0 +1,35 @@
'use client';
import useLazyRef from "../useLazyRef/useLazyRef.js";
import useOnMount from "../useOnMount/useOnMount.js";
export class Timeout {
static create() {
return new Timeout();
}
currentId = null;
/**
* Executes `fn` after `delay`, clearing any previously scheduled call.
*/
start(delay, fn) {
this.clear();
this.currentId = setTimeout(() => {
this.currentId = null;
fn();
}, delay);
}
clear = () => {
if (this.currentId !== null) {
clearTimeout(this.currentId);
this.currentId = null;
}
};
disposeEffect = () => {
return this.clear;
};
}
export default function useTimeout() {
const timeout = useLazyRef(Timeout.create).current;
useOnMount(timeout.disposeEffect);
return timeout;
}