UseEventListener

A function that attaches an automatically disposed event listener.

Demo

You've clicked 0 Times

Usage

	<script lang="ts">
	import { useEventListener } from "runed";
 
	const activeElement = useActiveElement();
	const text = $derived(
		`Currently active element: ${
			activeElement.value !== nulla
				? activeElement.value.localName
				: "No active element found"
		}`a
	);
</script>
 
<div class="rounded-md bg-card p-8">
	<p>{text}</p>
</div>	
MIT

© 2024 Svecosystem Team