feat: add barcode reader
This commit is contained in:
22
src/app/types/globalThis.d.ts
vendored
Normal file
22
src/app/types/globalThis.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
type ImageBitmapSource = HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | VideoFrame | Blob | ImageData
|
||||
|
||||
export type BarcodeDetectorOptions = {
|
||||
formats: string[]
|
||||
}
|
||||
|
||||
export type DetectedBarcode = {
|
||||
boundingBox: DOMRectReadOnly;
|
||||
cornerPoints: coords[];
|
||||
format: string[];
|
||||
rawValue: string;
|
||||
}
|
||||
|
||||
declare global {
|
||||
var BarcodeDetector: BarcodeDetector;
|
||||
}
|
||||
|
||||
declare type BarcodeDetector = {
|
||||
new (formats?: {formats: string[]}): BarcodeDetector;
|
||||
static getSupportedFormats(): Promise<string[]>;
|
||||
detect(imageBitmapSource: ImageBitmapSource): Promise<DetectedBarcode[]>;
|
||||
}
|
||||
Reference in New Issue
Block a user