5.0.0 • Published 8 months ago

clickometer v5.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Clickometer

Light library to handle the clicks over DOM element with javascript easily.

Install

If you want you can use other npm manager such as yarn, pnpm...

npm install clickometer

Alternatively you can use the script from CDN

<script async src="https://unpkg.com/clickometer@3.0.0/dist/clickometer.browser.min.js">

Usage example

import clickometer from "clickometer"

clickometer({
  DOMElement: document,
  maxClicks: 5,
  timeInterval: 1000,
  onChange: ({ percentatge }) => {
    document.body.style.backgroundColor = "initial";
    document.body.innerHTML = percentatge + "%";
  },
  onExceeded: ({ percentatge }) => {
    document.body.style.backgroundColor = "red";
    document.body.innerHTML = `¡Cuidado!, ${percentatge}% completado`;
  },
});

Params

DOMElement

Type: HTMLElement\ Default: document.body

maxClicks

Type: number\ Default: 5

timeInterval

Type: number\ Default: 1000

onChange

Type: Function\ Default: () => {}

onExceeded

Type: Function\ Default: () => {}

customEvents

Type: Array\ Default: []

5.0.0

8 months ago

4.1.0

8 months ago

4.0.1

8 months ago

4.0.0

8 months ago

3.0.0

8 months ago

2.0.0

8 months ago

1.0.0

8 months ago

0.0.1

8 months ago