- Dev/prod URL auto-detection (Vite 5173 in dev, server 3000 in prod) - Typed IPC bridge via preload (notifications, badge, window controls, updates, deep links) - Native OS notifications via NotificationController with window focus suppression - Auto-update via electron-updater with UpdateToast UI - Deep linking (backspace:// protocol) for macOS and Windows/Linux - Window state persistence (position, size, maximize across restarts) - Tray icon with graceful fallback when icon asset missing - Suppress PWA service worker polling/reloads inside Electron - Platform detection layer (isElectron, getElectronAPI) - Root workspace scripts (dev:desktop, build:desktop) - Document BACKSPACE_URL and BACKSPACE_UPDATE_URL env vars
22 lines
731 B
TypeScript
22 lines
731 B
TypeScript
import { isElectron } from './platform';
|
|
|
|
export function sendNotification(title: string, body: string): void {
|
|
if (isElectron()) {
|
|
window.backspace!.showNotification(title, body);
|
|
} else if ('Notification' in window && Notification.permission === 'granted') {
|
|
new Notification(title, { body, icon: '/icons/icon-192.png' });
|
|
}
|
|
}
|
|
|
|
export function requestNotificationPermission(): Promise<boolean> {
|
|
if (isElectron()) return Promise.resolve(true);
|
|
if (!('Notification' in window)) return Promise.resolve(false);
|
|
return Notification.requestPermission().then((p) => p === 'granted');
|
|
}
|
|
|
|
export function updateBadgeCount(count: number): void {
|
|
if (isElectron()) {
|
|
window.backspace!.setBadgeCount(count);
|
|
}
|
|
}
|