Skip to content

Initial Release v.1.0.0

Choose a tag to compare

@retrotheft retrotheft released this 15 Dec 08:24
· 31 commits to main since this release

Initial Release

A svelte wrapper for mainloop.js that handles function registration and cleanup, and lets you join and leave the loop with a single component. It provides debugging info and tools, exposes all of the standard mainloop.js functionality, is fully typed, and provides inline documentation through intellisense.

Features

  • Easy loop joining/leaving with <JoinLoop> component
  • Automatic cleanup when components are removed
  • Delta time provided in seconds for easier calculations
  • Debug interface via <ViewLoop> component
  • Full TypeScript support with inline documentation
  • Access to all mainloop.js stages (begin, update, draw, end)

Installation

npm install svelte-mainloop

Basic Usage

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

   function update(delta) {
      // do something
   }
</script>

<JoinLoop {update}>

More info in the README.

You may also like to read the official MainLoop.js documentation.