You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 18, 2022. It is now read-only.
My primary goal: save battery life and increase performance for users running Chrome and/or Firefox (or any browser that supports the appropriate APIs).
Recent discussion titled: "Chrome will aggressively throttle background tabs"
I run a real time charting platform for Bitcoin traders (like those using BitMEX) and the app does a lot of updating/refreshing. I recently learned of the visibilitychange API and managed to make huge improvements in the app's performance when running in the background - on the order of ~75% reduction in CPU usage when running in the background. [1]
var doVisualUpdates = true;
document.addEventListener('visibilitychange', function(){
doVisualUpdates = !document.hidden;
});
Basically, you can use this to determine if your tab is running "in the background" and avoid redrawing/refreshing components to show updates that won't ever be seen.
[1] https://twitter.com/cryptowat_ch/status/817502626896089090
What does Vue.js do when the tab is in the background (user is looking at another tab, might return in future). Chrome will throttle tabs that don't have active websockets/audio. I do have an active websockets on my application and I expect my average user to be slammed with DOM updates from websockets.
Does Vue.js hold all DOM updates until the user returns to the tab?
Can there be a mixin or other type of plugin for this?