Skip to content

Commit

Permalink
feat(connect-webextension): emit events for WEBEXTENSION.CHANNEL_HAND…
Browse files Browse the repository at this point in the history
…SHAKE_CONFIRM
  • Loading branch information
karliatto authored and mroz22 committed Feb 22, 2024
1 parent 25572af commit 4ab8a8c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/connect-webextension/src/proxy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ERRORS,
IFRAME,
POPUP,
WEBEXTENSION,
createErrorMessage,
ConnectSettings,
Manifest,
Expand Down Expand Up @@ -52,6 +53,12 @@ const init = (settings: Partial<ConnectSettings> = {}): Promise<void> => {
});
}

_channel.port.onMessage.addListener((message: any) => {
if (message.type === WEBEXTENSION.CHANNEL_HANDSHAKE_CONFIRM) {
eventEmitter.emit(WEBEXTENSION.CHANNEL_HANDSHAKE_CONFIRM, message);
}
});

return _channel.init().then(() =>
_channel.postMessage(
{
Expand Down

0 comments on commit 4ab8a8c

Please sign in to comment.