/* * Copyright 2021 Google LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ export type Config = { name: string; info: string; label: string; readonly: boolean; } & ( | { type: 'range'; value: number; min: number; max: number; step: number } | { type: 'menu' | 'radio'; value: string; choices: string[] } | { type: 'toggle'; value: boolean } | { type: 'text'; value: string } | { type: 'window'; children: Record } | { type: 'section'; children: Record } | { type: 'datetime'; value: number } ); declare interface SupportedOps { captureImage: boolean; captureVideo: boolean; captureAudio: boolean; capturePreview: boolean; config: boolean; triggerCapture: boolean; } declare class Context { context(): Promise { throw new Error('Method not implemented.'); } configToJS(): Promise; setConfigValue( name: string, value: number | string | boolean ): Promise; capturePreviewAsBlob(): Promise; captureImageAsFile(): Promise; consumeEvents(): Promise; supportedOps(): SupportedOps; delete(): void; isDeleted(): boolean; } export declare class Camera { constructor(); connect(): Promise; disconnect(): Promise; getConfig(): Promise; // replace "any" with the actual type of the config if you have it getSupportedOps(): SupportedOps; setConfigValue(name: string, value: number | string | boolean): Promise; capturePreviewAsBlob(): Promise; captureImageAsFile(): Promise; consumeEvents(): Promise; private rethrowIfCritical(err: any): void; // any error type can be replaced by more specific if available private schedule(op: (ctx: any) => Promise): Promise; // ctx and T types can be replaced by more specific if available } export interface Module extends EmscriptenModule { Context: typeof Context; } export type { Context }; declare const initModule: EmscriptenModuleFactory; export default initModule;