1.0.0 • Published 1 year ago

svelte-touch-hold v1.0.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

What it does?

  • runs a callback function after touching and holding the component for specific milliseconds. it only fires the "holding" callback on touch screens.

Example.gif dfdsf

Props list

NameTypeDescription
tagstringwrapper element for the component
delaynumbernumber of milliseconds needed to hold the component before triggering the callback
onHoldfunctionruns this function after pressing the component for specific milliseconds
onClickfunctionJust a simple onClick event. Unless onHold, You can run this with clicking with the mouse

How to use?

<script>
	import TouchHold from 'svelte-touch-hold'
	
	const callback = () => {
		alert('Do something fancy!!!')
	}
	
</script>

<TouchHold tag='button' delay={2000} onHold={callback}>
	Hello world 
</TouchHold>