<script>
import tapEvent from 'svelte-tap-event'
let tapCounter = 0
const onTap = () => {
tapCounter++
}
</script>
<div use:tapEvent on:tap={onTap}>
<h1 class="header">Tap me!</h1>
{#if tapCounter}
<p>
Tapped x{tapCounter}
</p>
{/if}
</div>
<style>
.header {
border: 2px solid indigo;
display: inline-block;
padding: 14px;
cursor: pointer;
outline: none;
}
p {
position: absolute;
left: 10px;
bottom: 10px;
}
</style>