diff --git a/src/services/desktop-api.ts b/src/services/desktop-api.ts index 708b992b..66ddeed4 100644 --- a/src/services/desktop-api.ts +++ b/src/services/desktop-api.ts @@ -56,4 +56,12 @@ interface NativeContextMenuSubmenu { items: readonly NativeContextMenuItem[]; } -export const DesktopApi: DesktopApi = window.desktopApi ?? {}; \ No newline at end of file +// Quick fix to avoid this file crashing the update SW which doesn't have 'window' available, without +// also breaking old Electron that doesn't have globalThis: +const global = typeof globalThis !== 'undefined' + ? globalThis + : typeof window !== 'undefined' + ? window + : {}; + +export const DesktopApi: DesktopApi = global.desktopApi ?? {}; \ No newline at end of file