All files / web/src/lib/vision/opencv loaderV5.ts

0% Statements 0/19
0% Branches 0/1
0% Functions 0/1
0% Lines 0/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20                                       
'use client'

/**
 * OpenCV.js Loader v5 - returns Promise without internal await.
 * The await happens in the consumer, not in this module.
 */

import { addOpenCVScript } from './addScript'
import { waitForCv } from './waitForCv'

// Returns the Promise directly - NO internal await
export function loadOpenCVv5(): Promise<unknown> {
  addOpenCVScript()

  // Return the promise chain - let consumer await it
  return waitForCv().then(() => {
    return (window as unknown as { cv: unknown }).cv
  })
}