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

Feature Request: embed .wasm file inside of vim.html so you have a single html file with everything. Like vim.html #48

Open
ilse-langnar opened this issue Sep 30, 2022 · 0 comments

Comments

@ilse-langnar
Copy link

What is an issue which you want to solve with your feature request?

I want to have a single "vim.html" where everything is contained, even if it makes the file bigger. I already embedded the "VimWasm.js" inside a <script>.

So in this I only have to "import" the "vim.js" file like this:

const screenCanvasElement = document.getElementById('vim-screen');
const vim = new VimWasm({ // VimWasm is available in the global scope via window.VimWasm(loaded via <script>)
    workerScriptPath: './node_modules/vim-wasm/small/vim.js',
    canvas: screenCanvasElement,
    input: document.getElementById('vim-input'),
});

The problem is that when you're inside of vim.js it uses fetch to get the vim.wasm binary so you need a server running to have this working.

Describe the solution you'd like

The solutions would be that you can actually embed .wasm inside of a .html file via base64 encoding, this might not be the most good for performance but for portability it's great!( see https://stackoverflow.com/questions/52582367/a-single-file-webassembly-html-demo and https://gist.github.com/dio/ae79cf546e808a9bc46515bf9400ad5d)

I have tried edit the code myself but it uses both WebAssembly.instantiate and WebAssembly.instantiateStreaming so I'm not exactly sure what to do thus I'm opening this issue.

Additional context (if any)

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