    imageData: null
    }
  }
}

export const keepScanning = (videoElement, options) => {
  const barcodeDetector = new BarcodeDetectorPolyfill({ formats: ["qr_code"] });

  const { detectHandler, locateHandler, minDelay } = options;

  const processFrame = state => async timeNow => {
    if (videoElement.readyState > 1) {
      console.log("scan")
      const { lastScanned, contentBefore, locationBefore } = state

      if (timeNow - lastScanned >= minDelay) {
        const detectedCodes = await barcodeDet