diff --git a/.gitignore b/.gitignore index 42e6c4e..bcd122a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /.vscode/c_cpp_properties.json /.libs /libapi.* +!/libapi.mjs.d.ts /node_modules diff --git a/libapi.mjs.d.ts b/libapi.mjs.d.ts new file mode 100644 index 0000000..eda796f --- /dev/null +++ b/libapi.mjs.d.ts @@ -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 } + | { type: 'section'; children: Record } + | { type: 'datetime'; value: number } +); + +declare class Context { + configToJS(): Promise; + setConfigValue( + name: string, + value: number | string | boolean + ): Promise; + capturePreviewAsBlob(): Promise; + captureImageAsFile(): Promise; + hasPendingEvent(): Promise; + + delete(): void; + isDeleted(): boolean; +} + +export interface Module extends EmscriptenModule { + Context: typeof Context; +} + +export type { Context }; + +declare const initModule: EmscriptenModuleFactory; +export default initModule;