Skip to content
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

Move the caching mechanism (powered by SuperRepo) to the background service worker #53

Open
superKalo opened this issue Dec 8, 2024 · 1 comment

Comments

@superKalo
Copy link
Owner

After the service worker was introduced in #45, we can now move the caching mechanism (powered by SuperRepo) to the background.

This will further optimize the use case when many new tabs are opened. Right now, every new tab creates a separate SuperRepo instance (that counts down until the data is out of date and fires a request to the background service worker to get the latest).

Ideally, this should be refactored to a singleton that lives in the background.

@superKalo
Copy link
Owner Author

Tech note: workaround to run the SuperRepo lib with the BROWSER_STORAGE in the service worker:

// Define `window` object with chrome ref, SuperRepo lib expects `window` being available
self.window = { chrome };
importScripts('../lib/index.js'); // SuperRepo lib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant