mirror of
https://github.com/opencv/opencv.git
synced 2025-08-05 22:19:14 +08:00
Update js_usage.markdown to use onRuntimeInitialized
The Emscripten library is not guaranteed to be fully loaded during the script element's onload event. Module.onRuntimeInitialized seems to be more reliable.
This commit is contained in:
parent
ea1c970190
commit
d1ccb7e47f
@ -122,11 +122,14 @@ imgElement.onload = function() {
|
||||
mat.delete();
|
||||
};
|
||||
|
||||
function onOpenCvReady() {
|
||||
document.getElementById('status').innerHTML = 'OpenCV.js is ready.';
|
||||
}
|
||||
var Module = {
|
||||
// https://emscripten.org/docs/api_reference/module.html#Module.onRuntimeInitialized
|
||||
onRuntimeInitialized() {
|
||||
document.getElementById('status').innerHTML = 'OpenCV.js is ready.';
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script async src="opencv.js" onload="onOpenCvReady();" type="text/javascript"></script>
|
||||
<script async src="opencv.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
@endcode
|
||||
|
Loading…
Reference in New Issue
Block a user