File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ TypeScript is supported (thanks to `mirada`).
1111``` js
1212import cvModule from " @techstark/opencv-js" ;
1313
14- async function main () {
15- // This works with both Promise and callback APIs
14+ async function getCv () {
1615 let cv;
1716 if (cvModule instanceof Promise ) {
1817 cv = await cvModule;
@@ -22,7 +21,11 @@ async function main() {
2221 });
2322 cv = cvModule;
2423 }
24+ return cv;
25+ }
2526
27+ async function main () {
28+ const cv = await getCv ();
2629 console .log (" OpenCV.js is ready!" );
2730 // You can now use OpenCV functions here
2831 console .log (cv .getBuildInformation ());
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ export async function setupOpenCv() {
1818 cv = cvModule ;
1919 }
2020 global . cv = cv ;
21- return { cv } ;
2221}
2322
2423export function translateException ( err : any ) {
You can’t perform that action at this time.
0 commit comments