mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 02:03:39 +00:00
[PM-7489] Introduce MessageSender & MessageListener (#8709)
* Introduce MessageSender * Update `messageSenderFactory` * Remove Comment * Use BrowserApi * Update Comment * Rename to CommandDefinition * Add More Documentation to MessageSender * Add `EMPTY` helpers and remove NoopMessageSender * Calm Down Logging * Limit Logging On Known Errors * Use `messageStream` Parameter Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Add eslint rules * Update Error Handling Co-authored-by: Cesar Gonzalez <cesar.a.gonzalezcs@gmail.com> * Delete Lazy Classes In Favor of Observable Factories * Remove Fido Messages --------- Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Cesar Gonzalez <cesar.a.gonzalezcs@gmail.com>
This commit is contained in:
@@ -124,12 +124,21 @@ export default {
|
||||
|
||||
sendMessage: (message: { command: string } & any) =>
|
||||
ipcRenderer.send("messagingService", message),
|
||||
onMessage: (callback: (message: { command: string } & any) => void) => {
|
||||
ipcRenderer.on("messagingService", (_event, message: any) => {
|
||||
if (message.command) {
|
||||
callback(message);
|
||||
}
|
||||
});
|
||||
onMessage: {
|
||||
addListener: (callback: (message: { command: string } & any) => void) => {
|
||||
ipcRenderer.addListener("messagingService", (_event, message: any) => {
|
||||
if (message.command) {
|
||||
callback(message);
|
||||
}
|
||||
});
|
||||
},
|
||||
removeListener: (callback: (message: { command: string } & any) => void) => {
|
||||
ipcRenderer.removeListener("messagingService", (_event, message: any) => {
|
||||
if (message.command) {
|
||||
callback(message);
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
launchUri: (uri: string) => ipcRenderer.invoke("launchUri", uri),
|
||||
|
||||
Reference in New Issue
Block a user