Files
electron/lib/browser/api/notification.ts
Shelley Vohr 4abf4cf868 feat: expose Notification.getHistory() on Windows
Add a new `Notification.getHistory()` that retrieves all
notifications sent by the app from the Windows Action Center using
the `ToastNotificationHistory` API.

The implementation introduces a `ToastHistoryEntry` struct and parses
each toast's XML content to reconstruct notification properties
including title, body, icon, silent, hasReply, timeoutType, actions,
replyPlaceholder, sound, urgency, and closeButtonText. The raw toast
XML is also returned as `toastXml` for cases where the parsed fields
are insufficient.

Currently Windows-only; returns an empty array on other platforms.
2026-03-18 09:49:25 +01:00

12 lines
408 B
TypeScript

const binding = process._linkedBinding('electron_browser_notification');
const ElectronNotification = binding.Notification;
ElectronNotification.isSupported = binding.isSupported;
ElectronNotification.getHistory = binding.getHistory;
if (process.platform === 'win32' && binding.handleActivation) {
ElectronNotification.handleActivation = binding.handleActivation;
}
export default ElectronNotification;