Riff / Built on the open web / Platform
pagehide
Captures the exact position when the listener leaves the page.

How Riff uses it
The save function that writes the queue and position to sessionStorage is bound to pagehide. So the last currentTime is captured when the listener follows a link, closes the tab, or the page enters the back-forward cache.
Why
Without it the restored position could be up to five seconds stale. pagehide fires reliably where unload does not, including on mobile.
Where
- plugins/riff/assets/riff.js, line 1489
window.addEventListener( 'pagehide', save );
Links open the source at the commit this page was published from.
Reference: pagehide on MDN.