Skip to content

Loading…

getViews for extension-popup communication #732

Closed
chrisaljoudi opened this Issue · 3 comments

2 participants

@chrisaljoudi
Owner

https://developer.chrome.com/extensions/extension#method-getViews

Why isn't this being used instead of the relatively-hacky message passing between the background script and popover?

For instance, this could be easily used by the background script to call a function in the popover script to update content (which eliminates the need for the poll, but yet keeps it simple to implement).

This is available in Safari as well (under a different name). That slight difference merely means that the platform-specific code has to set vAPI.popupView or something.

Looking at the Firefox code, this should be just as simple and neat there, too.

@chrisaljoudi
Owner

P.S.: I know there's lots to work on, @gorhill, so I'd be happy to get working on this in a separate branch.

@gorhill

relatively-hacky message passing between the background script and popover

I don't find messaging hacky, rather the opposite, I like the hardcore separation of duty enforced through messaging, taking care of their own world only, and having the client pages pull the data rather than the background process push the data in case something needs it.

For example, the only task of the background page when a new request arrive is to keep a timestamp at which time the change occur. Now whatever clients, if any, can poll whether something changed since they last polled if they have an interest. So the background page doesn't have to care whatever view(s) is open and to have to know whether they need something or not, whatever view needs something, they will just to ask if they need it.

Messaging is needed anyways because that's the only way possible for content scripts.

@gorhill

For instance, this could be easily used by the background script to call a function in the popover script to update content

I don't want this. Regardless of messaging, we need to poll, as we are not going to update the popup menu (which most of the time does not exist anyways) tens of time per second each time stats change in burst. To avoid this we would end up with the same mechanism, or similar enough.

@gorhill gorhill closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.