Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/victrme/clickdown

Speeds up your clicks by combining the speed of pointerdown, and the features of the click event
https://github.com/victrme/clickdown

accessibility dom event-listener javascript library npm

Last synced: about 2 months ago
JSON representation

Speeds up your clicks by combining the speed of pointerdown, and the features of the click event

Awesome Lists containing this project

README

        

# clickdown

[npmjs](https://www.npmjs.com/package/clickdown) - [demo](https://clickdown.pages.dev/)

Speeds up clicks by combining the speed of pointerdown and the features of click in a single "clickdown" event.

It attaches the `onclickdown` function to Element and HTMLElement prototypes, which means you can use it with `getElementById`, `querySelector`, and others.

Like this:

```js
import 'clickdown'

document.getElementById('my-input').onclickdown(function (event, target) {
console.log(event) // PointerEvent
console.log(target) //
})
```

With options:

```js
import 'clickdown'

const input = document.getElementById('my-input')
const listener = () => console.log('Hello world !')

input.onclickdown(listener, {
propagate: false,
})
```