JavaScript ‘wake’ event
blog.alexmaccaw.com
blog.alexmaccaw.com
Peridically waking up an idle CPU just to check the time has a surprisingly big effect on power consumption. This might be a real issue if you have this page open in your smartphone browser but the phone is idle but not sleeping in your pocket.
[1]: http://www.paulirish.com/2011/requestanimationframe-for-smar...
That repaint may occur up to 60 times per second for foreground tabs (the exact rate is up to the browser to decide), but may be reduced to a lower rate in background tabs.
https://developer.mozilla.org/en-US/docs/Web/API/window.requ...
The problem here isn't awaking the CPU, but rather awaking the radios. If you don't turn on the radios, polling every 20 seconds shouldn't be a problem. I'd mix this approach with something like the Page Visibility API, so you don't fetch data unless the site is the active tab.