svelte-mainloop

Svelte MainLoop

The easiest and most powerful way to add a loop to your Svelte app.

npm i svelte-mainloop

NEW: Attachments for Canvas let you set and forget. (req. Svelte 5.29)

<script>
   import { JoinLoop } from 'svelte-mainloop'

   let seconds = $state(0)

   function update(delta) {
      seconds += delta
   }
</script>

<JoinLoop {update} />

0.0