Wavedash init script

• Home • Edit


This post explains how to initialize Wavedash in your web game:

Script

window.Wavedash is available before your game starts so call init() in your index.html:

<script>
window.Wavedash&&(Wavedash.updateLoadProgressZeroToOne(1),Wavedash.init());
</script>

If you don’t call init(), your game is blocked behind a loading screen.

SDK

Bundler

If you bundle your game, install the SDK for editor autocomplete and types:

npm install @wvdsh/sdk-js
import Wavedash from "@wvdsh/sdk-js";

Wavedash.updateLoadProgressZeroToOne(1);
Wavedash.init();

The package re-exports the window.Wavedash global that Wavedash already provides, so there’s nothing extra to download at runtime and no version to pin.

CDN

You can also import it straight from esm.sh without a build step:

<script type="module">
  import('https://esm.sh/@wvdsh/sdk-js').then(({ default: Wavedash }) => {
    Wavedash.updateLoadProgressZeroToOne(1);
    Wavedash.init();
  });
</script>

This adds a network request on load and throws outside Wavedash, so use wavedash dev for local development. Prefer the script approach unless you want the package’s types.

GitHub Action

Inject the script using wavedash-action. Set inject-init: false if your game calls init() itself.