Skip to main content

Store

Convert a legacy svelte store into rune-powered runeStore state.

Demo

runeStore.current: 0
$store: 0

Usage

		<script lang="ts">
	import { Store } from "runed";
	import { writable } from "svelte/store";
 
	const store = writable(0);
	const runeStore = new Store(store);
</script>
 
<div>
	<p>Rune: {runeStore.current}</p>
	<button onclick={() => runeStore.current++}>Increment via runeStore</button>
	<p>Store: {$store}</p>
	<button onclick={() => ($store = $store + 1)}>Increment via store</button>
</div>