@forgesworn/qr
Version:
Dependency-free QR code encoder and decoder for TypeScript, browsers, workers and Node, with optional WebAssembly and tracked camera scanning.
16 lines (15 loc) • 874 B
TypeScript
import type { DecodeResult } from './decode.js';
import type { DecodeOptions, ImageLike } from './image.js';
/** A reusable, synchronous decoder for consecutive frames from one camera. */
export interface Decoder {
/** Reads fresh pixels each time, trying the previous region before the full frame. */
decode(image: ImageLike, options?: DecodeOptions): DecodeResult | undefined;
/** Forgets the previous region and releases references to working storage. */
reset(): void;
}
/**
* Shares the tracking policy across backends. It retains a search rectangle,
* never the caller's pixels or a previous payload.
* On a region miss it searches the whole frame during the same call.
*/
export declare function trackedDecoder(read: (image: ImageLike, options: DecodeOptions) => DecodeResult | undefined, release: () => void, generation?: () => number): Decoder;