mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
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.
12 lines
408 B
TypeScript
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;
|