-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix cyclic dependency. We need to keep the popup-messaging file to ha…
…ndle static access to the messaging port.
- Loading branch information
1 parent
a006817
commit 7665739
Showing
7 changed files
with
38 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* @typedef {import('webextension-polyfill').Runtime.Port} Port | ||
* @typedef {import('@duckduckgo/privacy-dashboard/schema/__generated__/schema.types').IncomingExtensionMessage} OutgoingPopupMessage | ||
*/ | ||
|
||
// Messaging connection with the popup UI (when active). | ||
/** @type {Port?} */ | ||
let activePort = null; | ||
|
||
export function getActivePort() { | ||
return activePort; | ||
} | ||
|
||
/** | ||
* | ||
* @param {Port?} port | ||
*/ | ||
export function setActivePort(port) { | ||
activePort = port; | ||
} | ||
|
||
/** | ||
* Post a message to the popup UI, if it's open. | ||
* | ||
* @param {OutgoingPopupMessage} message | ||
*/ | ||
export function postPopupMessage(message) { | ||
activePort?.postMessage(message); | ||
} |