@manuelernestog/click-handler
v1.4.1
Published
Handle click and double click events on same element on javascript.
Downloads
60
Maintainers
Readme
manuelernestog/click-handler
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);
}