Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tap-listener

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tap-listener

Listens to taps

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Tap listener

Listens to taps

On mobile devices, the click event is triggered after a delay. Tap Listener listens for native touch and pointer events to trigger a callback immediately.

Used in Flickity.

var tapper = new TapListener( element );
tapper.on( 'tap', function( event ) {
  console.log('tap happened');
});

Use TapListener to extend a class.

function Widget() {
  //...
}
// inherit Tap Listener
Widget.prototype = new TapListener();
// or
_.extend( Widget.prototype, TapListener.prototype );

var widgy = new Widget( element );
widgy.on( 'tap', function() {...});

Install

Bower: bower install tap-listener --save

npm: npm install tap-listener

RequireJS

requirejs( [ 'path/to/tap-listener' ], function( TapListener ) {
  var tapper = new TapListener( element );
});

Browserify

var TapListener = require('tap-listener');
var tapper = new TapListener( element );

API

var tapper = new TapListener( element )
// element {Element} - binds tap events to element

tapper.bindTap( element )
// element {Element} - binds tap events to element

tapper.unbindTap()
// unbinds tap events

tapper.on( eventName, callback )
// eventName {String} - tap, pointerDown, pointerMove, pointerUp, pointerCancel
// callback {Function}

function callback( event, pointer ) {...}
// event {Event} - the original mouseup, touchend, or pointerup event
// pointer {Event} or {Touch} - event object with pageX and pageY

tapper.destroy()
// unbinds tap events

MIT license

By Metafizzy

Keywords

FAQs

Package last updated on 15 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc