useElementSize

A higher-order function that debounces the execution of a function.

Demo

Usage

	<script lang="ts">
  import { useElementSize } from "runed";
 
  let el = $state() as HTMLElement;
  const size = useElementSize(() => el);
</script>
 
<div>
  <textarea bind:this={el} />
  <p>Width: {size.width} Height: {size.height}</p>
</div>	
MIT

© 2024 Svecosystem Team