Challenge 1
Complete the spec's flush trigger.
document.addEventListener('visibilitychange', () => {
if (document.visibilityState === '') flushBeacons();
});
Fill in the missing lifecycle states, events, and the flusher's guards.
Challenge 1
document.addEventListener('visibilitychange', () => {
if (document.visibilityState === '') flushBeacons();
});
Challenge 2
window.addEventListener('', (e) => {
closeSockets();
releaseLocks();
if (e.persisted) markBfcacheEntry();
});
Press Ctrl⌘Enter to check your answer
Challenge 3
window.addEventListener('pageshow', (e) => {
if (e.) shipRestorePageview();
});
Press Ctrl⌘Enter to check your answer
Challenge 4
lastState = 'visible';
maybeFlush(state) {
if (state === this.lastState) ; // same state, no second beacon
this.lastState = state;
this.flush();
}
Press Ctrl⌘Enter to check your answer
Challenge 5
// On mobile the OS may kill the process while hidden —
// no event is guaranteed afterwards.
Press Ctrl⌘Enter to check your answer