Socket
Socket
Sign inDemoInstall

@redneckz/click-cluck

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @redneckz/click-cluck

Postpones click event to prevent it in case of dblclick event


Version published
Maintainers
1
Install size
33.4 kB
Created

Changelog

Source

[0.0.5] - 2018-02-24

Fixed

  • Bug #1 "Single click events are not fired in IE at all"

Added

  • Updated README with some thoughts about UX

Readme

Source

click-cluck

Postpones "click" event to prevent it in case of "dblclick" event

NPM Version Build Status Coverage Status Bundle size

Generally it is a bad idea to have meaningful click and dblclick handlers on the same target. But if your styleguide already includes such things, this utility will help.

Installation

npm install --save @redneckz/click-cluck

How-to

Pure JS Example

<div role="row" id="the-best-product">
  <span role="cell">The best price ever!<span>
  <span role="cell">Give me two!<span>
</div>
import { ClickCluck } from '@redneckz/click-cluck';

const theBestProduct = ClickCluck(document.getElementById('the-best-product'));

theBestProduct.onclick = () => console.log('Just wait a bit...');
theBestProduct.ondblclick = () => console.log('Need a package?');

Press twice intermittently. And you will get:

Just wait a bit...
Just wait a bit...

Make double click. And here it is:

Need a package?

Also timeout can be configured:

const theBestProduct = ClickCluck(
  document.getElementById('the-best-product'),
  500, // 500ms by default
);

License

MIT

Keywords

FAQs

Last updated on 24 Feb 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc