-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sidePanel
API: lifecycle events
#517
Comments
+1 🙏. Here are my similar requests - https://groups.google.com/a/chromium.org/g/chromium-extensions/c/cJmdMLmpbjg |
Any tricks of trying to track the visibility of our extension in the side panel via document.hidden or via clients.matchAll() didn't work. When the user switches between OS applications or minimizes the browser, we get a message that the document is invisible, which makes sense. So we need a native sidepanel API method to report show/hide and window Id accurately. |
Yep, this, this is not so critical. Although I would like to have such a common event for all contexts that may occur in chrome.runtime.getContext - https://developer.chrome.com/docs/extensions/reference/api/runtime#method-getContexts For now, it’s easier to use a poll every 5 seconds. |
Polling is not an alternative. By that suggestion, you don't need almost any events, you can just poll it. Events are useful specifically because they let you avoid polling. That's the whole point of events: you want to respond to changes immediately without continuously waking up the background worker. |
The life cycle events of SidePanel are so important that I searched a lot of information to find it here. I look forward to its early release. |
Our extension uses sidebar to display extra content about the current website, the content script communicates to the sidebar, acting as a controller.
It would be useful to have more control over it, specifically, to only do operations when the sidebar is open or know when it's opened/closed.
Proposal: lifecycle events
Some example useful events could be:
.sendMessage
to all the relevant contextschrome.runtime.connect
'sonDisconnect
event if there are multiple sidebars open, because the connection is preserved across instances: https://stackoverflow.com/a/36465331onbeforeunload
because.sendMessage
doesn't completeSome other more specific events could be:
visibilitychange
, the current extension's sidePanel is shown)These two are less important, I suppose a local
visibilitychange
+runtime.sendMessage
could work as well.The text was updated successfully, but these errors were encountered: