Replies: 1 comment 1 reply
-
A progress indicator certainly make a lot of sense in dealing with the long loading times. The initOpenCascade function is currently just a super simple wrapper around Emscripten's instantiation mechanism: import opencascade from "./dist/opencascade.wasm.js";
import wasmFile from "./dist/opencascade.wasm.wasm";
export const initOpenCascade = () => {
return new opencascade({
locateFile(path) {
if(path.endsWith('.wasm')) {
return wasmFile;
}
return path;
}
});
} (This is necessary for supporting build systems like webpack, as the (potentially hashed) URL of the wasm file might not be not what Emscripten expects it to be). The actual fetching of the WASM files and instantiation is handled by Emscripten. Emscripten allows customization of that process with several properties of the Module Object. It seems like this function For the upcoming version, I think it would make sense to allow users to pass whatever prop they want to Emscripten's Module object / instantiation. It would probably also make sense to have a simplified interface for progress reports as you suggested built-in to this library. But short-term, I think it is better if the number of interfaces maintained by this project stays as small as possible. |
Beta Was this translation helpful? Give feedback.
-
Not sure how easy it would be since this project heavily relies on codgen. An idea I had is having a progress callback for
initOpenCascade
for download progress of the wasm file. I think it would be useful since it can take a while to download depending on internet speed.I know that
XMLHttpRequest
have progress eventsExample usage:
Beta Was this translation helpful? Give feedback.
All reactions