Skip to content

Commit

Permalink
Merge pull request #55 from michelerenzullo/patch-1
Browse files Browse the repository at this point in the history
Thank you so much. There may be a way to load the script under the hood for flutter. I am loading it here https://github.com/juancastillo0/wasm_run/blob/6dc89ca63199c7589d84d4714405b87a5bb2f148/packages/wasm_run/lib/src/ffi/web.dart#L22-L69 and I don't remember having any issues, however maybe the debugger or something in flutter web changed.

> do we actually need our own Dart Runtime instead of relying on other projects
What do you mean with "Dart Runtime"? do you mean implementing the wasi library in Dart?
  • Loading branch information
juancastillo0 committed May 5, 2024
2 parents 6dc89ca + b64b0be commit 90cc286
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,21 @@ We use [package:wasm_interop](https://pub.dev/packages/wasm_interop) to implemen

However, in web browsers there is no support for the [WAT](https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format) format and other queries that you may perform over the WASM modules on native platforms. For example, WASM [function type definitions](https://github.com/WebAssembly/js-types/blob/main/proposals/js-types/Overview.md) of arguments and results are not provided in most browsers. If you need these features, you may use the compiled WASM module (TODO: Not implemented yet).

We use the [wasm-feature-detect JavaScript library](https://github.com/GoogleChromeLabs/wasm-feature-detect) for feature detection in the browser. To use this functionality in Dart web applications you will need to add the following script to your html (not necessary for Flutter):
We use the [wasm-feature-detect JavaScript library](https://github.com/GoogleChromeLabs/wasm-feature-detect) for feature detection in the browser. To use this functionality in Dart web applications you will need to add the following script to your HTML:

```html
<script src="./packages/wasm_run/assets/wasm-feature-detect.js"></script>
<script type="module" src="./packages/wasm_run/assets/browser_wasi_shim.js"></script>
```

This is also required in Flutter, in `web/index.html`, if your code calls any function, or needs any object implemented in `browser_wasi_shim`:
```html
<head>
<script src="/assets/packages/wasm_run/lib/assets/wasm-feature-detect.js" defer></script>
<script type="module" src="/assets/packages/wasm_run/lib/assets/browser_wasi_shim.js" defer></script>
<head>
```


## Parse Web Assembly Text Format (WAT)

Expand Down

0 comments on commit 90cc286

Please sign in to comment.