webview: Adjust app.dock feature test for TypeScript friendliness.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2025-06-18 12:18:54 -07:00
parent 2e7ed457f0
commit 598aa6f4b9

View File

@@ -1,6 +1,5 @@
import type {WebContents} from "electron/main";
import fs from "node:fs";
import process from "node:process";
import * as remote from "@electron/remote";
import {app, dialog} from "@electron/remote";
@@ -251,10 +250,7 @@ export default class WebView {
webContents.on("page-favicon-updated", (_event, favicons) => {
// This returns a string of favicons URL. If there is a PM counts in unread messages then the URL would be like
// https://chat.zulip.org/static/images/favicon/favicon-pms.png
if (
favicons[0].indexOf("favicon-pms") > 0 &&
process.platform === "darwin"
) {
if (favicons[0].indexOf("favicon-pms") > 0 && app.dock !== undefined) {
// This api is only supported on macOS
app.dock.setBadge("●");
// Bounce the dock