svelte-taphold
TypeScript icon, indicating that this package has built-in type declarations

1.0.3-remake • Public • Published

Svelte Tap Hold

Minimalistic tap and hold component for Svelte/SvelteKit.

Installation

// Using Yarn to install
yarn add --dev svelte-taphold

// or if you prefer NPM
npm install --save-dev svelte-taphold

Usage Sample

<script>
  import { taphold } from 'svelte-taphold'

  let ticks = 0 // show how many ticks button has been hold
  let interval = 100

  const onTapHold = () => ticks++
  const reset = () => ticks = 0
</script>

<h1>Tap and Hold {ticks}x</h1>
<label for="interval">Interval</label>
<input
  id="interval"
  placeholder="interval"
  bind:value={interval}
  type="number"/>

<!-- svelte-taphold on button -->
<button
  use:taphold={interval}
  on:taphold={onTapHold} >
  Tap and Hold
</button>

<button on:click={reset}>Reset Iteration</button>

Readme

Keywords

none

Package Sidebar

Install

npm i svelte-taphold

Weekly Downloads

7

Version

1.0.3-remake

License

MIT

Unpacked Size

3.18 kB

Total Files

6

Last publish

Collaborators

  • binsarjr