add buttons that communicate with the browser extension (Athou/commafeed-browser-extension#1)

This commit is contained in:
Athou
2023-06-07 15:03:27 +02:00
parent fafc0619ad
commit 662c0fc6b9
32 changed files with 356 additions and 7 deletions

View File

@@ -0,0 +1,9 @@
export const useBrowserExtension = () => {
// when not in an iframe, window.parent is a reference to window
const isBrowserExtension = window.parent !== window
const openSettingsPage = () => window.parent.postMessage("open-settings-page", "*")
const openAppInNewTab = () => window.parent.postMessage("open-app-in-new-tab", "*")
return { isBrowserExtension, openSettingsPage, openAppInNewTab }
}