diff --git a/projects/notification-electron/src/lib/services/notification.service.ts b/projects/notification-electron/src/lib/services/notification.service.ts index 9def565..014cbb7 100644 --- a/projects/notification-electron/src/lib/services/notification.service.ts +++ b/projects/notification-electron/src/lib/services/notification.service.ts @@ -78,7 +78,7 @@ export const defaultOptions: DefaultOptions = { export type OnShow4NotificationWindow = () => Promise; export type OnClose4NotificationWindow = () => Promise; export type OnClick4NotificationWindow = () => Promise; -export type OnUser4NotificationWindow = ( +export type OnMessage4NotificationWindow = ( channel: string, ...args: any[] ) => Promise; @@ -95,7 +95,7 @@ export interface Notification { onShow?: OnShow4NotificationWindow; onClose?: OnClose4NotificationWindow; onClick?: OnClick4NotificationWindow; - onUser?: OnUser4NotificationWindow; + onMessage?: OnMessage4NotificationWindow; } class WindowPooler { @@ -542,8 +542,8 @@ export class NotificationService { this.__onClick4NotificationWindow.bind(this) ); Electron.ipcMain.on( - NotificationWindowChannel.onUser, - this.__onUser4NotificationWindow.bind(this) + NotificationWindowChannel.onMessage, + this.__onMessage4NotificationWindow.bind(this) ); Electron.screen.on( @@ -570,8 +570,8 @@ export class NotificationService { this.__onClick4NotificationWindow.bind(this) ); Electron.ipcMain.off( - NotificationWindowChannel.onUser, - this.__onUser4NotificationWindow.bind(this) + NotificationWindowChannel.onMessage, + this.__onMessage4NotificationWindow.bind(this) ); Electron.screen.off( @@ -612,18 +612,18 @@ export class NotificationService { activated.notification.onClick(); } - private __onUser4NotificationWindow( + private __onMessage4NotificationWindow( event: Electron.IpcMainEvent, notificationId: number, channel: string, ...args: any[] ): void { const activated = this.__findActivatedByNotificationId(notificationId); - if (!activated || !activated.notification.onUser) { + if (!activated || !activated.notification.onMessage) { return; } - activated.notification.onUser(channel, ...args); + activated.notification.onMessage(channel, ...args); } private __onDisplayAdded4ElectronScreen( diff --git a/projects/notification-electron/src/lib/types/channel.type.ts b/projects/notification-electron/src/lib/types/channel.type.ts index 167b65b..dae0aeb 100644 --- a/projects/notification-electron/src/lib/types/channel.type.ts +++ b/projects/notification-electron/src/lib/types/channel.type.ts @@ -1,11 +1,11 @@ export enum NotificationChannel { - init4NotificationWindow = 'notification-electron::NotificationChannel::init4NotificationWindow', - ready4NotificationWindow = 'notification-electron::NotificationChannel::ready4NotificationWindow', - reset4NotificationWindow = 'notification-electron::NotificationChannel::reset4NotificationWindow', + init4NotificationWindow = 'notification-electron::NotificationChannel::init4Window', + ready4NotificationWindow = 'notification-electron::NotificationChannel::ready4Window', + reset4NotificationWindow = 'notification-electron::NotificationChannel::reset4Window', } export enum NotificationWindowChannel { onClose = 'notification-electron::NotificationWindowChannel::onClose', onClick = 'notification-electron::NotificationWindowChannel::onClick', - onUser = 'notification-electron::NotificationWindowChannel::onUser', + onMessage = 'notification-electron::NotificationWindowChannel::onMessage', }