fix: missing emit so clients on the 'main' side could not be notified

Signed-off-by: Florent Benoit <fbenoit@redhat.com>
This commit is contained in:
Florent Benoit 2023-08-03 10:04:23 +02:00 committed by Florent BENOIT
parent cf5033d374
commit 6f11e8bca6
2 changed files with 17 additions and 0 deletions

View file

@ -175,3 +175,19 @@ test('Check SecurityRestrictions on known domains', async () => {
// expect openExternal has been called
expect(shell.openExternal).toBeCalledWith('https://www.podman-desktop.io');
});
test('Should apiSender handle local receive events', async () => {
const apiSender = pluginSystem.getApiSender(webContents);
expect(apiSender).toBeDefined();
let fooReceived = '';
apiSender.receive('foo', (data: any) => {
fooReceived = String(data);
});
// try to send data
apiSender.send('foo', 'hello-world');
// data should have been received
expect(fooReceived).toBe('hello-world');
});

View file

@ -281,6 +281,7 @@ export class PluginSystem {
// add to the queue
queuedEvents.push({ channel, data });
}
eventEmitter.emit(channel, data);
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
receive: (channel: string, func: any) => {