From a37aa2853b3a212d367820b08b2ba8a8dd648afa Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Fri, 23 Jul 2021 20:04:42 +0000 Subject: [PATCH] Commit typings --- .gitignore | 1 + libapi.mjs.d.ts | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 libapi.mjs.d.ts 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;