Challenge 1
Detect whether the classic beacon transport exists.
export function detect() {
return typeof navigator. === 'function';
}
Press Ctrl⌘Enter to check your answer
Fill in the missing pieces of feature detection and the fire-and-forget contract.
Challenge 1
export function detect() {
return typeof navigator. === 'function';
}
Press Ctrl⌘Enter to check your answer
Challenge 2
const supportsKeepalive =
typeof fetch === 'function' &&
'keepalive' in .prototype;
Press Ctrl⌘Enter to check your answer
Challenge 3
// the spec mandates fetch() with initiator type
const initiator = "";
Press Ctrl⌘Enter to check your answer
Challenge 4
window.addEventListener('unload', () => {
const xhr = new XMLHttpRequest();
xhr.open('POST', '/analytics', ); // blocked in page dismissal
xhr.send(body);
});
Press Ctrl⌘Enter to check your answer
Challenge 5
document.addEventListener('', () => {
if (document.visibilityState === 'hidden') flush();
});
Press Ctrl⌘Enter to check your answer