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

mobile-touch-gesture

v1.0.3

Published

a mobile touch gesture library

Downloads

53

Readme

mobile-touch-gesture

current version 1.0.3

Foreword

This is a mobile touch gesture and pc mouse gesture library.

Feature

Gestures are supported below:

swiperStart, swiperMove, swiperEnd, swiperLeft,swiperRight, swiperUp, swiperDown,

swiperLeftRight, swiperLeftUp, swiperLeftDown,

swiperRightLeft, swiperRightUp, swiperRightDown,

swiperUpDown, swiperUpLeft, swiperUpRight,

swiperDownUp, swiperDownLeft ,swiperDownRight,

tap, doubleTap, longTap.

Usage

Import mobile touch gesture library, then new an instance via some necessary arguments.

import MobileTouchGesture from "mobile-touch-gesture";
......
const MTG = new MobileTouchGesture(document.documentElement || document.body, {
    // set tips text
    prompt: {
        nameMap: {
            swiperUp: 'Up!!!',
            swiperRight: 'Right!!!'
        }
    },
    // trigger function
    swiperStart(val) {
        console.log(val)
    },
    swiperMove(val1, val2) {
        console.log(val1, val2)
    },
    swiperEnd(val) {
        console.log(val)
    },
    swiperLeft() {
        console.log('swiperLeft')
    },
    swiperRight() {
        console.log('swiperRight')
    },
    swiperUp() {
        console.log('swiperUp')
    },
    swiperDown() {
        console.log('swiperDown')
    },
    swiperLeftRight() {
        console.log('swiperLeftRight')
    },
    swiperLeftTop() {
        console.log('swiperLeftTop')
    },
    swiperLeftDown() {
        console.log('swiperLeftDown')
    },
    swiperRightLeft() {
        console.log('swiperRightLeft')
    },
    swiperRightUp() {
        console.log('swiperRightUp')
    },
    swiperRightDown() {
        console.log('swiperRightDown')
    },
    swiperUpDown() {
        console.log('swiperUpDown')
    },
    swiperUpLeft() {
        console.log('swiperUpLeft')
    },
    swiperUpRight() {
        console.log('swiperUpRight')
    },
    swiperDownUp() {
        console.log('swiperDownUp')
    },
    swiperDownLeft() {
        console.log('swiperDownLeft')
    },
    swiperDownRight() {
        console.log('swiperDownRight')
    },
    tap(e) {
        console.log('tap')
    },
    doubleTap(e) {
        console.log('doubleTap')
    },
    longTap(e) {
        console.log('longTap')
    }
})

MobileTouchGesture class acept two arguments, first is target element, second is an options object

Arguement

| attribute | type | defalut value | descrition | | --------- | ------- | ------------- | -------------- | | ele | Element | | target element | | options | Object | | options |

Basice gestures: swiperStart, swiperMove, swiperLeft,swiperRight, swiperUp, swiperDown, swiperLeftRight, swiperRightLeft, swiperUpDown, swiperDownUp , tap, doubleTap, longTap.

If you want to handler more complex situation, you can use swiperStart and swiperMove to handle it.

You can get library version via MobileTouchGesture.version.

Options attributes

| attribute | type | defalut value | descrition | | -------------- | ------ | --------------------------------------------------- | ------------------------------------------------------------ | | effectiveValue | Number | 20 | trigger function until move distance reach effectiveValue | | prompt | Object | {show: false, nameMap:{invalid: 'invalidgesture'} } | show attribute is to defined tips show or not, and you can use nameMap to redefined gesture tips, when gesture is triggered | | longTapTime | Number | 200 ms | long press trigger time | | doubleTapTime | Number | 200 ms | double click gap time |

You can redefine time for long tap and double tap to trigger relative event.

Options funtions

| attribute | type | defalut value | descrition | | --------------- | -------- | ---------------------- | ------------------------ | | swiperLeft | Function | function(){} | slide left | | swiperRight | Function | function(){} | slide right | | swiperUp | Function | function(){} | slide up | | swiperDown | Function | function(){} | slide down | | swiperLeftRight | Function | function(){} | slide left then back | | swiperLeftUp | Function | function(){} | slide left then up | | swiperLeftDown | Function | function(){} | slide left then down | | swiperRightLeft | Function | function(){} | slide right then back | | swiperRightUp | Function | function(){} | slide right then up | | swiperRightDown | Function | function(){} | slide right then down | | swiperUpDown | Function | function(){} | slide up then back | | swiperUpRight | Function | function(){} | slide up then right | | swiperUpLeft | Function | function(){} | slide up then left | | swiperDownUp | Function | function(){} | slide down then back | | swiperDownRight | Function | function(){} | slide down then right | | swiperDownLeft | Function | function(){} | slide down then left | | tap | Function | function(e){} | click | | doubleTap | Function | function(e){} | double click | | longTap | Function | function(e){} | long press | | swiperStart | Function | function(val){} | trigger when touch start | | swiperMove | Function | function(val1, val2){} | trigger when move start | | swiperEnd | Function | function(val1, val2){} | trigger when move end |

中文文档

http://yunkus.com/post/5ddb6b3cf9b59b20e611e714