diff options
author | Sebastian <sebasjm@gmail.com> | 2024-02-29 15:45:22 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2024-02-29 15:45:22 -0300 |
commit | 206780bb0ee763bcf50a3f4f9f78579a8adcdb3a (patch) | |
tree | 7d332c27a7c64f676d6ac7101af125a806cf6318 /packages/taler-wallet-webextension/src/platform/chrome.ts | |
parent | 922d5b4d7aeed3f7c2f9eab1482f60d2fa50f234 (diff) | |
download | wallet-core-206780bb0ee763bcf50a3f4f9f78579a8adcdb3a.tar.xz |
observe UI, WIP
Diffstat (limited to 'packages/taler-wallet-webextension/src/platform/chrome.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/platform/chrome.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/taler-wallet-webextension/src/platform/chrome.ts b/packages/taler-wallet-webextension/src/platform/chrome.ts index d88dae460..fc2d1db09 100644 --- a/packages/taler-wallet-webextension/src/platform/chrome.ts +++ b/packages/taler-wallet-webextension/src/platform/chrome.ts @@ -45,6 +45,7 @@ const api: BackgroundPlatformAPI & ForegroundPlatformAPI = { findTalerUriInClipboard, getPermissionsApi, getWalletWebExVersion, + triggerWalletEvent, listenToWalletBackground, notifyWhenAppIsReady, openWalletPage, @@ -324,6 +325,18 @@ function listenToWalletBackground(listener: (m: any) => void): () => void { const allPorts: chrome.runtime.Port[] = []; + +function triggerWalletEvent(message: MessageFromBackend): void { + for (const notif of allPorts) { + // const message: MessageFromBackend = { type: msg.type }; + try { + notif.postMessage(message); + } catch (e) { + logger.error("error posting a message", e); + } + } +} + function sendMessageToAllChannels(message: MessageFromBackend): void { for (const notif of allPorts) { // const message: MessageFromBackend = { type: msg.type }; |