1.1.0 • Published 9 months ago

@tpguy825/clicker v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

clicker

Mouse event helper library for React

Examples

import { useLongPress, useLongHover } from "@tpguy825/clicker";
// or for preact
import { useLongPress, useLongHover } from "@tpguy825/clicker/preact";

function App() {
    const handlers = useLongPress(
        () => console.log("long press"),
        () => console.log("short press (click)"),
        { shouldPreventDefault: false, interval: 100 /* 0.1s */ },
    );

    return <button {...handlers}>Click me (then check the console)</button>;
}

function App() {
    const [hoveredForTime, handlers] = useLongHover(500);

    return <button {...handlers}>{hoveredForTime ? "You hovered for 0.5s!" : "Hover over me!"}</button>;
}
1.1.0

9 months ago

1.0.6

10 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago