You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could an API or Callback be provided in the xxx.js file generated by wasm-pack packaging, allowing developers to obtain the progress when downloading the wasm file? Because the wasm files generated by projects of different sizes may be 1MB, 5MB or even 10MB. If developers cannot get the download progress, they will not be able to display a progress bar on the web page, which is not a very good experience for users in front of the computer.
The command which I used: wasm-pack build --release --target web
💻 Basic example
// index.html
<body>
<!-- canvas required by the Slint runtime -->
<canvas id="canvas"></canvas>
<div id="loading">
<p>loading...</p>
<span id="current"></span> / <span id="total"></span> MB
</div>
<script type="module">
function show_progress(current, total) {
document.getElementById("current").innerText = (current / 1024 / 1024).toFixed(2);
document.getElementById("total").innerText = (total / 1024 / 1024).toFixed(2);
}
import init, { start } from "./pkg/memlib.js"; // The memlib.js is automatically generated by wasm-pack.
let options = {fetchProgress: show_progress, /*.. some other options */ };
await init(options);
document.getElementById("loading").style.display = "none"; // Initialization completed, hide the 'loading' div
start(); // start my program
</script>
</body>
The text was updated successfully, but these errors were encountered:
💡 Feature description
Could an API or Callback be provided in the
xxx.js
file generated bywasm-pack
packaging, allowing developers to obtain the progress when downloading thewasm
file? Because thewasm
files generated by projects of different sizes may be 1MB, 5MB or even 10MB. If developers cannot get the download progress, they will not be able to display a progress bar on the web page, which is not a very good experience for users in front of the computer.The command which I used:
wasm-pack build --release --target web
💻 Basic example
The text was updated successfully, but these errors were encountered: