Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 658 Bytes

File metadata and controls

30 lines (22 loc) · 658 Bytes

onLongPress

onLongPress allows you to bind a callback to a long press occurring (i.e. a pointer being held down for a specified amount of time).

Usage

class MyElement extends LitElement {
  render() {
    return html`
      <div ${onLongPress(this._onLongPress)}>
        Long press me!
      </div>
    `;
  }
}

This will call the _onLongPress method when the user holds their pointer down for 1 second (the default).

The parameters (onLongPress(fn, time)) are as follows:

  • fn - a function to call when the pointer has been held long enough
  • time - the time in milliseconds to consider a press being 'long'

Options

N/A