Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/avishwakarma/preact-long-press-event

☝️ onLongPress for preact
https://github.com/avishwakarma/preact-long-press-event

Last synced: about 2 months ago
JSON representation

☝️ onLongPress for preact

Awesome Lists containing this project

README

        

# preact-long-press-event: `onLongPress` for __[Preact]__

`onLongPress` is a CustomEvent generated using native Event.

Inspired by [long-press]
---

## Usage

`npm i -S preact-long-press-event`

```js
// in your index.js

import injectLongPressEvent from 'preact-long-press-event';

/**
* @params {object} options
*
* Options can be an object containing duration property
*
* {
* duration:
* }
*
* The default delay duration is 1500
*/
injectLongPressEvent();

// in your component

class MyComponent extends Component {

longPress(event) {
// longPress event handller
}

render() {
return (


Long Press Me!

);
}
}
```
---

[Preact]: https://github.com/developit/preact
[long-press]: https://github.com/john-doherty/long-press/