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

jestures

v1.0.0

Published

A (hopefully it stays) small web gesture library.

Downloads

5

Readme

jestures

A (hopefully it stays) small web gesture library.

Installing

npm install jestures -S
yarn jestures

Usage

on('swipe')((swipeEvent) => { console.log('swiped ', swipeEvent.detail.direction) })

on

eventName -> callback -> target -> off The on function is the only exposed function. See Gestures for the gesture events that can be listened for.

Gestures

tap

The tap event is what is wanted most of the time you want to react to a user 'click' on an element. It bypasses the usual 300 millisecond delay and makes your app feel more responsive.

const offTap = on('tap')((tapEvent) => {
  console.log(`just ${swipeEvent.type} it in. `)
  offTap()
})

double-tap

The double-tap event is fired when the user taps twice in succession within 300ms. It should be noted that a double-tap event will be preceded by two tap events.

const offDoubleTap = on('double-tap')((tapEvent) => {
  console.log(`just ${swipeEvent.type} it in. `)
  offDoubleTap()
})

single-tap

There may be occasions where a single tap needs to be distinguished from a double-tap. Usually, this only happen when a single tap and a double-tap each have distinctly different meanings and different actions need to be taken for each of them respectively. In those case, using the tap event would be less helpful. Instead, use the single-tap which uses the default experience of a 300ms delay before firing the event to ensure the tap in not just the first tap of a double tap gesture.

const offSingleTap = on('single-tap')((singleTapEvent) => {
  console.log(`This is ${singleTapEvent.type}`)
  offSingleTap()
})

swipe

The swipe event fires whenever the user moves a touch more than 50px in either ordinal direction. The event includes a detail object with a direction property that has a value of either up, down, left, or right depending on which direction was the greatest.

const offSwipe = on('swipe')((swipeEvent) => {
  console.log('swiped ', swipeEvent.detail.direction)
  offSwipe()
})

pinch

The pinch event fires when a touchmove event happen with exactly two touch points originating from the same target element. The pinch event also has a detail object with a distance property that gives the distance between the two touch points. This is useful to map the scale of an element to the motion and growth of the gesture, or to determine whether the gesture is pinching - the distance between the touch points is diminishing - or spreading - the distance between touch points is growing.