event name is changed from onUser to onMessage
This commit is contained in:
parent
3a83f3b523
commit
caf46d7bd4
|
@ -78,7 +78,7 @@ export const defaultOptions: DefaultOptions = {
|
|||
export type OnShow4NotificationWindow = () => Promise<void>;
|
||||
export type OnClose4NotificationWindow = () => Promise<void>;
|
||||
export type OnClick4NotificationWindow = () => Promise<void>;
|
||||
export type OnUser4NotificationWindow = (
|
||||
export type OnMessage4NotificationWindow = (
|
||||
channel: string,
|
||||
...args: any[]
|
||||
) => Promise<void>;
|
||||
|
@ -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(
|
||||
|
|
|
@ -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',
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user