Skip to content

Commit

Permalink
feat(interface): update bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Curve committed Feb 6, 2024
1 parent 42688c9 commit 91efcf0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
31 changes: 31 additions & 0 deletions interface/src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export function chooseFile(setter: (value: string) => void, cancel?: () => void)
{
window.saucer.call("choose-path", []).then(result =>
{
if (result)
{
setter(result);
return;
}

if (!cancel)
{
return;
}

cancel();
});
}

export function chooseFolder(setter: (value: string) => void)
{
window.saucer.call("choose-folder", []).then(result =>
{
if (!result)
{
return;
}

setter(result);
});
}
15 changes: 8 additions & 7 deletions interface/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@ interface Window
{
call:
{
(func: "load", args: [string: path]): Promise<void>;
(func: "load", args: [string: path]): Promise<boolean | string>;

(func: "list", args: []): Promise<string[]>;
(func: "decompile", args: [string: name]): Promise<string>;

(func: "cancel", args: []): Promise<void>;
(func: "export", args: []): Promise<boolean>;
(func: "export", args: [string: path]): Promise<boolean>;

(func: "java-path", args: []): Promise<string>;
(func: "unluac-path", args: []): Promise<string>;
(func: "java-path", args: []): Promise<string?>;
(func: "unluac-path", args: []): Promise<string?>;

(func: "set-java-path", args: [string: path]): Promise<void>;
(func: "set-unluac-path", args: [string: path]): Promise<void>;
(func: "set-java-path", args: [string?: path]): Promise<void>;
(func: "set-unluac-path", args: [string?: path]): Promise<void>;

(func: "choose-path", args: []): Promise<string>;
(func: "choose-path", args: [string?: path]): Promise<string | null>;
(func: "choose-folder", args: [string?: path]): Promise<string | null>;
};
}

Expand Down

0 comments on commit 91efcf0

Please sign in to comment.