youtube / spfjs

A lightweight JS framework for fast navigation and page updates from YouTube
https://youtube.github.io/spfjs/
MIT License
2.24k stars 147 forks source link

Synchronously handle only background cached responses (experimental) #352

Closed nicksay closed 9 years ago

nicksay commented 9 years ago

To avoid the forced 1s delay in WebKit browsers when handling cached responses when in the background, synchronously execute the handler function instead of using a setTimeout of 0, but only if document.webkitVisibilityState is 'hidden'. For evaluation and testing, guard this behavior behind a experimental-sync-response-cache-background config flag.

Progress on #337

nicksay commented 9 years ago

New commit description:

To avoid the forced 1s delay in WebKit browsers when handling cached responses when in the background, synchronously execute the handler function instead of using a setTimeout of 0, but only if document.hidden is true. Note that this still will apply the synchronous behavior to all browsers, but limit the behavior to tabs that aren't visible. For evaluation and testing, guard this behavior behind a experimental-sync-response-cache-background config flag.

rviscomi commented 9 years ago

LGTM