Previous

Holds the previous value of a getter.

Demo

Previous: undefined

Usage

	<script lang="ts">
  import { Previous } from "runed";
 
  let count = $state(0);
  const previous = new Previous(() => count);
</script>
 
<div>
  <button onclick={() => count++}>Count: {count}</button>
  <pre>Previous: {`${previous.current}`}</pre>
</div>	
MIT

© 2024 Svecosystem Team