@manuelernestog/click-handler

1.4.1 • Public • Published

manuelernestog/click-handler

npm (scoped) npm bundle size (minified)

Handle click and dblclick events on same element on javascript.

Install

$ npm install @manuelernestog/click-handler
// or
$ yarn add @manuelernestog/click-handler

Usage

import ClickHandler from("@manuelernestog/click-handler");

const clickDelay = 500; // delay it's optional (350 miliseconds by default)
var clickHandler = new ClickHandler(clickDelay);

function onClickActions() {...}
function onDblClickActions() {...}

// Call the handle method inside your click action
function onClick() {

    clickHandler.handle(onClickActions,onDblClickActions);

    // If you need to handle this behavior in different elements in the same view, add the ID for isolating the state of each element
 clickHandler.handle(onClickActions,onDblClickActions,elementId);

}

Package Sidebar

Install

npm i @manuelernestog/click-handler

Weekly Downloads

12

Version

1.4.1

License

MIT

Unpacked Size

3.4 kB

Total Files

4

Last publish

Collaborators

  • manuelernestog