UNPKG

react-zxing

Version:

Integrate zxing to your React application using a custom hook

26 lines (25 loc) 907 B
/// <reference types="react" /> import { DecodeHintType, Exception, Result } from "@zxing/library"; export interface UseZxingOptions { paused?: boolean; hints?: Map<DecodeHintType, any>; timeBetweenDecodingAttempts?: number; onDecodeResult?: (result: Result) => void; onDecodeError?: (error: Exception) => void; onError?: (error: unknown) => void; } export interface UseZxingOptionsWithConstraints extends UseZxingOptions { constraints?: MediaStreamConstraints; } export interface UseZxingOptionsWithDeviceId extends UseZxingOptions { deviceId: string; } export declare const useZxing: (options?: UseZxingOptionsWithConstraints | UseZxingOptionsWithDeviceId) => { ref: import("react").RefObject<HTMLVideoElement | null>; torch: { isOn: boolean; isAvailable: boolean | null; on: () => Promise<void>; off: () => Promise<void>; }; };