Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web Hello world example #8

Open
lantos1618 opened this issue Jun 4, 2023 · 0 comments
Open

Web Hello world example #8

lantos1618 opened this issue Jun 4, 2023 · 0 comments

Comments

@lantos1618
Copy link

Hi I'm a bit compile hello world and then load it in the browser with the following. Are you able to do an example with this to point people in the right direction

Thanks

<!DOCTYPE html>
<html>

<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>Page Title</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <!-- <link rel='stylesheet' type='text/css' media='screen' href='main.css'> -->
    <script lang="ts">
        const importObject = {
            module: {},
            env: {
                memory: new WebAssembly.Memory({ initial: 256 }),
            }
        };
        const response = fetch('/wasmix-play.wasm').then((response) =>
            response.arrayBuffer()
        ).then((bytes) =>  WebAssembly.instantiate(bytes, importObject)
        ).then((instance) => {
            console.log(instance.exports);
        });
    </script>
</head>
<body>
</body>
</html>```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant