typescript more like gayscript
This commit is contained in:
parent
9cdcae11d2
commit
a8bf4b8a5a
19 changed files with 246 additions and 114 deletions
42
src/components/name.tsx
Normal file
42
src/components/name.tsx
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { createSignal, onCleanup } from "solid-js";
|
||||
import { removethething } from "./utils.ts";
|
||||
|
||||
function HoverComponent() {
|
||||
let timerId: number|null;
|
||||
|
||||
const [name, setname] = createSignal(true)
|
||||
|
||||
const startTimer = () => {
|
||||
timerId = setTimeout(() => {
|
||||
setname(!name())
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
const clearTimer = () => {
|
||||
if (timerId) {
|
||||
clearTimeout(timerId);
|
||||
timerId = null;
|
||||
}
|
||||
};
|
||||
|
||||
const handleMouseEnter = () => {
|
||||
removethething()
|
||||
startTimer();
|
||||
};
|
||||
|
||||
onCleanup(() => {
|
||||
clearTimer();
|
||||
});
|
||||
|
||||
return (
|
||||
<h1
|
||||
class="removethisinstantly"
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={clearTimer}
|
||||
>
|
||||
{name() ? "ECHO" : "exhq"}
|
||||
</h1>
|
||||
);
|
||||
}
|
||||
|
||||
export default HoverComponent;
|
||||
Loading…
Add table
Add a link
Reference in a new issue