This post explains how to initialize the Wavedash SDK in your web game using JavaScript.
Script
Add the script before the closing </body> tag in your index.html:
<script type="module">
import('https://esm.sh/@wvdsh/sdk-js').then(({ default: Wavedash }) => {
Wavedash.updateLoadProgressZeroToOne(1);
Wavedash.init();
});
</script>
The script:
- Loads the Wavedash SDK from esm.sh
- Updates the progress bar from 0% to 100%
- Initializes the Wavedash SDK
To pin the SDK to a specific version:
<script type="module">
- import('https://esm.sh/@wvdsh/sdk-js').then(
+ import('https://esm.sh/@wvdsh/[email protected]').then(
({ default: Wavedash }) => {
Wavedash.updateLoadProgressZeroToOne(1);
Wavedash.init();
},
);
</script>
Alternatively, you can inject the SDK using wavedash-action.