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

Suggestion register after page loaded #91

Open
beatrizdemiguelperez opened this issue Oct 4, 2017 · 3 comments
Open

Suggestion register after page loaded #91

beatrizdemiguelperez opened this issue Oct 4, 2017 · 3 comments

Comments

@beatrizdemiguelperez
Copy link

On the service-worker-registration.js

Delay registration until after the page has loaded, to ensure that our precaching requests don't degrade the first visit experience.
See https://developers.google.com/web/fundamentals/instant-and-offline/service-worker/registration they recommend doing this so...

if ('serviceWorker' in navigator) {
  window.addEventListener('load', function() {
    navigator.serviceWorker.register('/service-worker.js');
  });
}
@ghost
Copy link

ghost commented Oct 4, 2017

Ah great, will add this as a strategy when I have time :)

@simonihmig
Copy link
Contributor

I like that approach! But, as the linked article suggests...

Similarly, if your web app uses a framework that performs additional setup after the page has loaded, look for a framework-specific event that signals when that work is done.

... shouldn't this be done even after Ember has booted and the first render has happened (e.g. scheduled afterRender in an initializer)?

@NullVoxPopuli
Copy link
Contributor

if it's async, does it matter if ember has finished booting?

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

3 participants