-
Notifications
You must be signed in to change notification settings - Fork 113
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
offscreen.js purpose and functionality? #586
Comments
Maybe @praschke might have some insight on this one |
an indirection is always slower in absolute terms but that doesn't mean it's perceptible. even if it is perceptible, the capabilities of the service worker and the offscreen document are completely different, and the issue you mention is why the indirection was necessary. the purpose of those components being kept in the offscreen document is that the offscreen document can be kept alive forever. the service worker was taking forever to initialize the database and become ready, so it had to be moved out of the service worker. |
I see, so it's being treated as somewhat of a stand-in for the old background page where it seems to be always alive. Presumably this is because it is reading the clipboard, which is always running. My only worry after reading some of the docs is this: https://developer.chrome.com/blog/Offscreen-Documents-in-Manifest-v3
I.e. that chrome may break something by changing how this feature operates in the future. In any matter, I don't think using the offscreen window is the wrong choice here, but the codebase could be more clear about what issue it is solving. I'll take this as an action for me to do. |
I've done a little bit of looking into this, but I don't fully understand why some components are in offscreen.js, specifically the
Translator
andDictionaryDatabase
. As far as I can tell, this is supposed to address some sort of startup lag that would occur after the extension idles for a while and the service worker has to restart, but does anyone know how having these components in an offscreen document fix the issue? It seems like the additional indirection would make it slower in general.Related:
The text was updated successfully, but these errors were encountered: