From a0d70238a7d366bbefcdbabd2c59ccbd63c32713 Mon Sep 17 00:00:00 2001 From: Daniel Pereira Date: Mon, 15 Aug 2016 16:45:28 -0500 Subject: [PATCH] Update events --- electron-notify/electron-notify-tests.ts | 9 ++++++--- electron-notify/electron-notify.d.ts | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/electron-notify/electron-notify-tests.ts b/electron-notify/electron-notify-tests.ts index 9194a11f1b..95e2edf998 100644 --- a/electron-notify/electron-notify-tests.ts +++ b/electron-notify/electron-notify-tests.ts @@ -17,7 +17,10 @@ eNotify.notify({ image: 'path/to/image.png', url: 'http://google.de', sound: 'notification.wav', - onClickFunc: function () { console.log('onClick') }, - onShowFunc: function () { console.log('onShow') }, - onCloseFunc: function () { console.log('onClose') } + onClickFunc: (event) => { + console.log('onClick ' + event.id); + event.closeNotification('onClick'); + }, + onShowFunc: (event) => { console.log('onShow ' + event.id) }, + onCloseFunc: (event) => { console.log('onClose ' + event.id) } }); \ No newline at end of file diff --git a/electron-notify/electron-notify.d.ts b/electron-notify/electron-notify.d.ts index 198f8cafb6..3ad6906205 100644 --- a/electron-notify/electron-notify.d.ts +++ b/electron-notify/electron-notify.d.ts @@ -7,15 +7,24 @@ declare namespace ElectronNotify { + interface ICloseNotificationEvent { + event: 'close' | 'show' | 'click', + id: number + } + + interface INotificationEvent extends ICloseNotificationEvent { + closeNotification: (reason: any) => void, + } + interface INotification { title: string, text?: string, image?: string, url?: string, sound?: string, - onClickFunc?: (event: string, id: number, closeNotification: any) => void, - onShowFunc?: (event: string, id: number, closeNotification: any) => void, - onCloseFunc?: (event: string, id: number) => void + onClickFunc?: (event: INotificationEvent) => void, + onShowFunc?: (event: INotificationEvent) => void, + onCloseFunc?: (event: ICloseNotificationEvent) => void } interface IConfiguration {