<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8"/>
        <meta content="width=device-width, initial-scale=1.0" name="viewport"/>

        <title>Wails App</title>

        <link rel="stylesheet" href="main.css" />

        <script src="wasm_exec.js"></script>
        <script>
            const go = new Go();

            function runWASM(runner, module) {
                return runner(module, go.importObject).then((result) => go.run(result.instance));
            }

            function fallbackWASMInstantiate() {
                fetch('main.wasm')
                    .then((response) => response.arrayBuffer())
                    .then((buff) => runWASM(WebAssembly.instantiate, buff));
            }

            fetch('main.wasm').then((response) => {
                runWASM(WebAssembly.instantiateStreaming, response).catch((err) => {
                    if (response.headers.get('Content-Type') != 'application/wasm') {
                        console.warn('cannot stream wasm, binary served without `application/wasm` Content-Type header');
                        fallbackWASMInstantiate();
                    } else throw(err);
                });
            });
        </script>
    </head>
    <body>
        <div id="vugu_mount_point"></div>
    </body>
</html>