pcb icon indicating copy to clipboard operation
pcb copied to clipboard

AppCache events only fire once

Open enzoaeneas opened this issue 8 years ago • 11 comments

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.

enzoaeneas avatar Mar 21 '17 20:03 enzoaeneas

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

NekR avatar Mar 21 '17 23:03 NekR

I'll take a look this weekend at how to get the options into the templated manifest.html code and then submit a PR.

On Tue, Mar 21, 2017, 19:06 Arthur Stolyar [email protected] wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/NekR/offline-plugin/issues/210#issuecomment-288246912, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6KGcV2U41a_dKb7LgGUyTZ7da4bHsdks5roFfagaJpZM4MkYiY .

-- Kevin James

enzoaeneas avatar Mar 24 '17 22:03 enzoaeneas

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

NekR avatar Mar 24 '17 22:03 NekR

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 avatar Apr 25 '17 20:04 jampy

Wow. It's been a month since I looked at this. I'll work on the pull-request and get it submitted :-P

On Tue, Apr 25, 2017 at 4:22 PM jampy [email protected] wrote:

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...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NekR/offline-plugin/issues/210#issuecomment-297153502, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6KGX07oa-3ZXVj5na96Zk0VDzuYnWgks5rzlYWgaJpZM4MkYiY .

-- Kevin James

enzoaeneas avatar Apr 25 '17 23:04 enzoaeneas

@enzoaeneas There is already a PR, see: https://github.com/NekR/offline-plugin/pull/241

NekR avatar Apr 25 '17 23:04 NekR

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

jampy avatar May 03 '17 05:05 jampy

Let me see if I can get to it today. I'm working on a different projec nowt, but I am still primary on the other. I test in Chrome latest and IE 11. I *may *be able to get Safari.

On Wed, May 3, 2017 at 1:36 AM jampy [email protected] wrote:

@enzoaeneas https://github.com/enzoaeneas: do you have a chance to test #248 https://github.com/NekR/offline-plugin/pull/248?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NekR/offline-plugin/issues/210#issuecomment-298826784, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6KGVLPoUTq_28xQ9HOl5deng6J9Saxks5r2BJ4gaJpZM4MkYiY .

-- Kevin James

enzoaeneas avatar May 03 '17 14:05 enzoaeneas

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 avatar May 16 '17 19:05 NekR

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.

NekR avatar May 16 '17 19:05 NekR

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

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

jampy avatar May 28 '17 15:05 jampy