Electron Package Documentation
The Electron package currently publishes type definitions for building desktop notification integrations. Runtime helpers are not exported from the package entrypoint yet.
Installation
npm install @sparkstrand/notifications-electronWhat Is Exported
- • ElectronNotificationsConfig
- • MainProcessNotificationManager
- • RendererProcessNotificationManager
- • SystemNotificationOptions
- • TrayNotificationOptions
- • SoundNotificationOptions
- • NotificationWindowOptions
- • NotificationBadgeOptions
Usage Pattern
Define your own runtime manager in your Electron app and type it against this package interfaces.
import type {
ElectronNotificationsConfig,
MainProcessNotificationManager,
} from '@sparkstrand/notifications-electron';
const config: ElectronNotificationsConfig = {
apiUrl: 'https://notifications.sparkstrand.com/api',
appId: 'my-app-id',
enableSystemNotifications: true,
enableTrayNotifications: true,
};
let manager: MainProcessNotificationManager | null = null;
async function initialise(createManager: (cfg: ElectronNotificationsConfig) => MainProcessNotificationManager) {
manager = createManager(config);
await manager.initialize();
}Current Limitation
Functions such as setupNotifications, showSystemNotification, and renderer hooks are not currently exported. Use your own implementation or a private wrapper until a runtime API is published.