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

hammer-timejs

v1.1.0

Published

A fast click based on the touch-action css property

Downloads

42,679

Readme

Hammer Time!

Thors Hammer crashing down

On your click times!

Response time on user actions is important

Keeping visual response to under 100ms means your users will not notice the delay. The UI will feel quick and responsive giving users the impression they are doing the work instead of the application. Try the boxes below to see the response time on mobile devices.

The first box uses touch-action:none; to remove the 300ms delay. The second box has no touch-action property set. On touch screens you will see a noticeable difference in the response time of the background and in the outputting of the end vs click events.

The touch-action css property is part of the Pointer Events spec http://www.w3.org/TR/pointerevents/#the-touch-action-css-property

Unfourtanitly not all common browsers support touch action yet ( caniuse ) so hammer-time works by partially polyfills this property. The only supported value is none, manipulation, or auto

Advantages...

  • Size Hammer-time is very very small only 417 bytes gzipped
  • Easy to use no special libraries or events to bind. Hammer-time just speeds up the native events so you can use your favorite event library like jQuery or just plain old addEventListener
  • Based on real standards, Hammer-time is a polyfill so it is a complete noop on browsers which support native touch-action
  • Avoids target mismatches between the touchend and click events

Gotchas...

  • Only works when applied directly to the style attribute on an element not to a stylesheet
  • Does not prevent scrolling or other behaviors which happen on move or double tap zoom
  • You cannot set the touch-action property via element.style[ touch-action ] browsers that do not support touch action will ignore this
  • Removing the touch-action property from an existing element is not supported, Hammer-time has no way of knowing the difference between you removing the property and it being removed as a result or browser sanitization. Instead of removing the property completely simply change it to the default value of auto
  • Direct manipulation of the style property in a loop on elements with touch-action set from JavaScript ( JS animations for example ) should be avoided. Because of how browsers sanitize the style attribute when setting properties we use a mutation observe to restore the the touch action property when it is removed
  • To properly support IE10 you need to add both touch-action and -ms-touch-action

To read more about UI response times and how this effects user experience see http://www.nngroup.com/articles/response-times-3-important-limits/