main: Annotate permissionCallbacks.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-07-07 21:48:41 -07:00
parent fa3c744e76
commit cb7d1faa52

View File

@@ -30,7 +30,7 @@ let isQuitting = false;
// Load this url in main window
const mainURL = "file://" + path.join(__dirname, "../renderer", "main.html");
const permissionCallbacks = new Map();
const permissionCallbacks = new Map<number, (grant: boolean) => void>();
let nextPermissionCallbackId = 0;
const APP_ICON = path.join(__dirname, "../resources", "Icon");
@@ -156,7 +156,7 @@ function createMainWindow(): Electron.BrowserWindow {
ipcMain.on(
"permission-callback",
(event: Event, permissionCallbackId: number, grant: boolean) => {
permissionCallbacks.get(permissionCallbackId)(grant);
permissionCallbacks.get(permissionCallbackId)?.(grant);
permissionCallbacks.delete(permissionCallbackId);
},
);