Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript support #36

Open
madeleineostoja opened this issue Jun 1, 2021 · 2 comments
Open

Typescript support #36

madeleineostoja opened this issue Jun 1, 2021 · 2 comments

Comments

@madeleineostoja
Copy link

Hey thanks for the excellent library! Any chance of adding typescript definitions of the methods and custom event?

@HackJack-101
Copy link

I made a swipe-listener.d.ts

declare module 'swipe-listener' {
    interface SwipeInterface {
        off: () => void;
    }

    function SwipeListener(
        element: HTMLElement,
        options: {
            deltaHorizontal?: number; // Minimum number of pixels traveled to count as a horizontal swipe.
            deltaVertical?: number; // Minimum number of pixels traveled to count as a vertical swipe.
            lockAxis?: boolean; // Delta for horizontal swipe
            minHorizontal?: number; // Delta for vertical swipe
            minVertical?: number; // Prevents scrolling when swiping.
            mouse?: boolean; // Select only one axis to be true instead of multiple.
            preventScroll?: boolean; // Listen for touch events
            touch?: boolean; // Listen for mouse events
        },
    ): SwipeInterface | undefined;

    export = SwipeListener;
}

@rtritto
Copy link

rtritto commented Dec 4, 2024

@umanghome Any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants