Skip to content

Commit

Permalink
clean up app.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
emma-sg committed Jan 11, 2024
1 parent 51575b6 commit 675ac7c
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 270 deletions.
7 changes: 5 additions & 2 deletions src/electron/electron-rec-preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { ipcRenderer, contextBridge } = require("electron");
let downloadCallback;

// ===========================================================================
contextBridge.exposeInMainWorld("archivewebpage", {
const globalAPI = {
record: (opts) => {
ipcRenderer.send("start-rec", opts);
},
Expand All @@ -24,7 +24,10 @@ contextBridge.exposeInMainWorld("archivewebpage", {
downloadCancel: (dlprogress) => {
ipcRenderer.send("dlcancel:" + dlprogress.origFilename);
},
});
} as const;
export type GlobalAPI = typeof globalAPI;

contextBridge.exposeInMainWorld("archivewebpage", globalAPI);

// ===========================================================================
ipcRenderer.on("add-resource", async (event, data, collId) => {
Expand Down
4 changes: 4 additions & 0 deletions src/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ declare const __WEB3_STORAGE_TOKEN__: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
declare const pdfjsLib: any;

interface Window {
archivewebpage?: import("./electron/electron-rec-preload").GlobalAPI;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
declare type TODOFixMe = any;
9 changes: 9 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type ItemType } from "replaywebpage";
import { type BtrixClient } from "./ui/upload";

export type WrRecItem = ItemType & {
uploadTime?: number;
Expand All @@ -7,3 +8,11 @@ export type WrRecItem = ItemType & {
ipfsPins?: { url: string }[];
uploadId: string;
};

export type BtrixOpts = {
url: string;
username: string;
password: string;
orgName: string;
client?: BtrixClient;
};

0 comments on commit 675ac7c

Please sign in to comment.