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

Implement a Service Worker integration? #9

Open
L1lith opened this issue Dec 21, 2021 · 1 comment
Open

Implement a Service Worker integration? #9

L1lith opened this issue Dec 21, 2021 · 1 comment

Comments

@L1lith
Copy link

L1lith commented Dec 21, 2021

I know this is probably out of the scope of this project, but there's one feature I think would be sweet which is service worker integration. Currently I am using next-pwa, but it doesn't really fulfill my needs. Here's basically the service worker I need (I am considering just coding my own custom worker, but it would be cool to see an integration here):

The worker needs to cache the entire website when I press the download button (kind of like next-offline, but I couldn't get it to work properly). The reason I am doing this is because I am deploying my site as a progressive web application, so that people with limited internet connectivity can get reliable access to the site. The problem is that if I deploy the website in a large number of languages that's going to skyrocket the download size, hence the need to download the entire site, but only in the language selected by the user. This is why I think there's a need for integration between service workers and next translation solutions.

I'm not sure if this would mean implementing an entirely custom service worker for this library, or potentially providing an integration with an existing solution like next-pwa. Either way this is just an idea and you're welcome to decide whether this falls inside of the scope you have for this project or not.

@cvolant
Copy link
Collaborator

cvolant commented Dec 23, 2021

I might consider this suggestion in a few months. But...

this.consider = async function () {
  try {
    let attempts = 0
    while (attempts < TOO_MUCH) {
      const result = await headache() // May take hours or days
      if (result && Math.random() > NEARLY_ONE) {
        return result
      }
      attempts++
    }
  } catch (error) {
    throw new Error(`Impossible: ${error.message}`)
  }
  throw new Error(`F**k`)
}

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

No branches or pull requests

2 participants