Skip to content

Commit

Permalink
chore: update .gitignore and improve error handling in useOpenCV
Browse files Browse the repository at this point in the history
  • Loading branch information
iFwu committed Nov 1, 2024
1 parent e4451f2 commit 802fa22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?
*.tsbuildinfo
*.tsbuildinfo
.aider*
.env
7 changes: 6 additions & 1 deletion src/composables/useOpenCV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function useOpenCV() {
templates.value = markRaw(loadedTemplates);
} catch (err) {
chessStore.setError(`加载模板时出错: ${(err as Error).message}`);
throw err;
}
};

Expand All @@ -35,7 +36,11 @@ export function useOpenCV() {
return;
}
retries++;
if (!templates.value && typeof cv !== 'undefined') {
if (
!templates.value &&
typeof cv !== 'undefined' &&
typeof cv.Mat === 'function'
) {
clearInterval(intervalId);
await onOpenCVReady();
} else if (templates.value) {
Expand Down

0 comments on commit 802fa22

Please sign in to comment.