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

AppCache events only fire once #210

Open
enzoaeneas opened this issue Mar 21, 2017 · 11 comments
Open

AppCache events only fire once #210

enzoaeneas opened this issue Mar 21, 2017 · 11 comments

Comments

@enzoaeneas
Copy link

enzoaeneas commented Mar 21, 2017

The code within manifest.html removes the events after five seconds (cleanuptimer) and does not reattch them. My application may be updated at anytime while the browser is running, and I need to notify my users that an update is ready.
Currently events will only fire when the application is loaded.

@NekR
Copy link
Owner

NekR commented Mar 21, 2017

I see, thank for reporting it. PR is welcome to fix that (since you already figured out what the code does).

@enzoaeneas
Copy link
Author

enzoaeneas commented Mar 24, 2017 via email

@NekR
Copy link
Owner

NekR commented Mar 24, 2017

@enzoaeneas okay, thank you! Feel free to ask questions if something won't be clear.

@jampy
Copy link

jampy commented Apr 25, 2017

IMHO that 5000 ms timeout effectively prevents any Application Cache events after 5000ms. So, if the application takes longer than 5 seconds to download, no UpdateReady is ever fired.

  • what's the point in cleaning up anyway? It obviously makes sense to stop that 50ms interval, but why run also removeEventListener? I guess those three event listeners takes up less space in memory than the code that removes them. ;-)
  • why is the interval needed? Looks like a polyfill or something similar. Are there browsers that don't provide event listeners for application cache?

Unfortunately Application Cache is still very important for PWAs, because not all browsers support Service Workers, yet...

jampy pushed a commit to jampy/offline-plugin that referenced this issue Apr 25, 2017
…n't unregister events after 5000ms

potential fix for NekR#210
@enzoaeneas
Copy link
Author

enzoaeneas commented Apr 25, 2017 via email

@NekR
Copy link
Owner

NekR commented Apr 25, 2017

@enzoaeneas There is already a PR, see: #241

@jampy
Copy link

jampy commented May 3, 2017

@enzoaeneas: do you have a chance to test #248?

@enzoaeneas
Copy link
Author

enzoaeneas commented May 3, 2017 via email

@NekR
Copy link
Owner

NekR commented May 16, 2017

I found some of my notes regarding AppCache statuses/events (on macOS) (posting here instead of in the #248 PR to be to find it easier):

/*
  UNCACHED = 0;
  IDLE = 1;
  CHECKING = 2;
  DOWNLOADING = 3;
  UPDATEREADY = 4;
_____________________

  # No Update
    * Chrome: 2, 1
    * Safari: 2, 1
    * Firefox: 2, 1

    * Chrome events: checking, noupdate
    * Safari events: checking, noupdate
    * Firefox events: noupdate

  # Has Update
    * Chrome: 2, then 4
    * Safari: 2, sometimes 3, then 4
    * Firefox: 4, 2, 3, 1, 3, 4

    * Chrome events: checking, progress, updateready
    * Safari events: checking, downloading, progress, updateready
    * Firefox events: downloading, progress

  # First install
    * Chrome: 2, 3, 1
    * Safari: 0, 3, 1
    * Firefox: 0, 1

    * Chrome events: checking, downloading, progress, cached
    * Safari events:  checking, downloading, progress, cached
    * Firefox events: checking, downloading, progress, cached

  # Manifest error
    * Chrome: 2, 5
    * Safari: 2, 5
    * Firefox: 1, 2, 5

    * Chrome events: checking, obsolete
    * Safari events: checking, obsolete
    * Firefox events: checking, obsolete

  # Manifest error when not installed
    * Chrome: 2, 0
    * Safari: 0
    * Firefox: 0

    * Chrome events: checking, error
    * Safari events: checking, error
    * Firefox events: checking, error
*/

@NekR
Copy link
Owner

NekR commented May 16, 2017

That one excludes IE/Edge, but AFAIR it has similar to Chrome events/statuses, I just didn't test it a lot in IE/Edge.

@jampy
Copy link

jampy commented May 28, 2017

@NekR: completely missed this since I was waiting for a reply in the PR.

Anyway, could you please explain what this stuff means? Thanks.

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

3 participants