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

ractive-events-tap

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ractive-events-tap

Tap/fastclick event plugin for Ractive.js

  • 0.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
decreased by-53.85%
Maintainers
2
Weekly downloads
 
Created
Source

ractive-events-tap

Find more Ractive.js plugins at ractivejs.org

Tap/fastclick event plugin for Ractive.js - eliminates the 300ms delay on touch-enabled devices, and normalises across mouse, touch and pointer events.

Pressing the spacebar while an element is focused, which would normally dispatch a click event, is also equivalent to 'tapping' it.

<button on-tap='activate()'>
  tap me!
</button>

Installation

Include it from CDN...

<script src="https://cdn.jsdelivr.net/npm/ractive@0.9.3/ractive.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ractive-events-tap@0.3.1/dist/ractive-events-tap.umd.min.js"></script>

...or install from npm...

npm install ractive-events-tap

...or download it and add it as a script tag to your page:

<script src='ractive.js'></script> <!-- must go first! -->
<script src='ractive-events-tap.js'></script>

Use as a module...

Note: previous versions of this plugin would 'self-register'. If you are using a module system such as Browserify, Webpack or RequireJS, that's no longer the case - you must explicitly register the plugin.

CommonJS

var Ractive = require( 'ractive' );

// To use the tap event with a specific instance
var ractive = new Ractive({
  el: 'body',
  template: myTemplate,
  events: {
    tap: require( 'ractive-events-tap' )
  }
});

// To use it with components
MyTappableComponent = Ractive.extend({
  template: componentTemplate,
  events: {
    tap: require( 'ractive-events-tap' )
  }
});

// To make it globally available to *all* instances
Ractive.events.tap = require( 'ractive-events-tap' );

AMD

define([ 'ractive', 'ractive-events-tap' ], function ( Ractive, tap ) {
  var ractive = new Ractive({
    el: 'body',
    template: myTemplate,
    events: {
      tap: tap
    }
  });
});

ES6

import Ractive from 'ractive';

var ractive = new Ractive({
  el: 'body',
  template: myTemplate,
  events: { tap }
});

Use as a <script> tag

If you include ractive-events-tap as a script tag, it will 'self-register' with the global Ractive object, and all Ractive instances will be able to use it.

Commands when Contributing

npm run build #compile
npm run test # run chrome 55+

License

MIT

FAQs

Package last updated on 21 Jul 2018

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