emscripten-core / emscripten-core/emscripten

Allow progress reporting when loading runtime dependencies

Open
#16,278 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

https://github.com/emscripten-core/emscripten/blob/9e4fcf9c87522642719c9ec75df47363561ca6ea/src/library.js#L3618-L3632

In the above code there is an onload and onerror, I would like to support an `onprogress` there too.

Currently it's possible to somewhat monitor dependencies download through `monitorRunDependencies` in the Emscripten Generated HTML, you can modify the function this Module component uses to get at least intermediary report per dependency. My wasm code though is around 6MB, it's usually fast to download but occasionally I get into a region where my phone has poor connection and it takes a bit, but I get no progress report.

I know every bit of code added impacts codesize of everyone, so I don't have any current suggestion on how to do so.

With onprogress event, people could then report download progress with something like:

```JavaScript
if (e.lengthComputable) {
setStatus('loading ' + Math.round((e.loaded / e.total) * 100) + '% ...');
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.