Commit typings

This commit is contained in:
Ingvar Stepanyan
2021-07-23 20:04:42 +00:00
parent ca75f61289
commit a37aa2853b
2 changed files with 38 additions and 0 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,5 @@
/.vscode/c_cpp_properties.json
/.libs
/libapi.*
!/libapi.mjs.d.ts
/node_modules

37
libapi.mjs.d.ts vendored Normal file
View File

@@ -0,0 +1,37 @@
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<string, Config> }
| { type: 'section'; children: Record<string, Config> }
| { type: 'datetime'; value: number }
);
declare class Context {
configToJS(): Promise<Config & { type: 'window' }>;
setConfigValue(
name: string,
value: number | string | boolean
): Promise<undefined>;
capturePreviewAsBlob(): Promise<Blob>;
captureImageAsFile(): Promise<File>;
hasPendingEvent(): Promise<boolean>;
delete(): void;
isDeleted(): boolean;
}
export interface Module extends EmscriptenModule {
Context: typeof Context;
}
export type { Context };
declare const initModule: EmscriptenModuleFactory<Module>;
export default initModule;