At the moment, the app detects when OpenCV is ready by passing a callback to the onload handler of the async script tag used to load opencv.js.
However, even though OpenCV is loaded, not all its APIs are ready for use, for example, cv.Mat may not be ready when the callback is called.
According to this postcv['onRuntimeInitialized'] can be used to assign a callback which will be fired when the APIs area ready for use:
cv.onRuntimeInitialized = () => {
// cv is ready
};
No issue has occurred yet because of this, since by the time the editor is loaded and code executed, OpenCV will have had enough time to load, but I foresee it causing issues if we have code that is executed when the app is being setup.
At the moment, the app detects when OpenCV is ready by passing a callback to the
onload
handler of the async script tag used to loadopencv.js
.However, even though OpenCV is loaded, not all its APIs are ready for use, for example,
cv.Mat
may not be ready when the callback is called.According to this post
cv['onRuntimeInitialized']
can be used to assign a callback which will be fired when the APIs area ready for use:No issue has occurred yet because of this, since by the time the editor is loaded and code executed, OpenCV will have had enough time to load, but I foresee it causing issues if we have code that is executed when the app is being setup.