npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gesture-customizer

v1.0.12

Published

Help you customize and manage gesture action in web.

Downloads

11

Readme

Note

Help you customize and manage gesture action in web. It can work well with JS, React or Vue

add issues if you need more features :)

Installation

npm install gesture-customizer

OR

yarn add gesture-customizer

Usage

import {
    Gesture
} from 'gesture-customizer';

const callbackFn = () => {
    // ...do something
}

// registry a gesture listener.
Gesture.registry(
    // listen left-right mousedown with pressing ctrl key
    {
        mouseType: 'LR', 
        ctrlKey: true
    },

    // trigger callback when the mouse moves toward bottom more than 300px
    // and then move towards right less than 500px in 2 seconds
    // and move top more than 300px at the end
    [
        {
            direction: 'B',
            minDistance: 300
        },
        {
            direction: 'R',
            maxDistance: 500,
            maxSpendTime: 2000,
        },
        {
            direction: 'T',
            minDistance: 300
        }
    ],

    callbackFn
);

// remove a gesture listener.
Gesture.remove({
    mouseType: 'LR'
}, callbackFn);

// pause all gesture listener
Gesture.pause();

// resueme all gesture listener
Gesture.resume();

API docs

interface KeyType

Define the gesture trigger buttons. It can combine with ctrl and shift key.

| Arguments | description | Accepted Values | Default | |-------------|---------------------------------------------------------------------------------------------:|:----------------------:|:-------:| | mouseType | which mouse buttons can trigger callback, L = Left, R = Right, M = Middle(wheel) | L / R / LR / M | | | ctrlKey? | only trigger event when ctrl key was pressed | boolean | false | | shiftKey? | only trigger event when shift key was pressed | boolean | false |

interface GestureAction

Define the mouse move path, only trigger callback when user did action which is satisfied all limitation.

| Arguments | description | Accepted Values | Default | |-----------------|--------------------------------------------------------------------:|:---------------:|:--------:| | direction | the mouse move direction | Direction | | | minDistance? | Not trigger callback if moving distance is less than minDistance | number | 100 | | maxDistance? | Not trigger callback if moving distance is large than maxDistance | number | infinity | | maxSpendTime? | The maxium spends time on user done this action | number | infinity |

/** T = Top
 *  R = Right
 *  B = Bottom
 *  L = Left
*/ 
type Direction = 'T' | 'TR' | 'R' | 'RB' | 'B' | 'BL' | 'L' | 'LT';

Gesture. registry(keyType, gestureAction[], callback)

registry a gesture listener.

Gesture. remove(keyType, callback)

remove a gesture listener.

Gesture. pause()

pause all gesture listener

Gesture. resume()

resueme all gesture listener

License

MIT