Skip to content
Foxipa
Code Completion 5 Challenges

Complete the code: The 64 KiB Quota

Fill in the missing quota constants and the in-flight accounting.

Intermediate ~4 min read

Challenge 1

Set the pool size the Fetch spec actually defines.

js Your answer
// ONE shared in-flight pool per fetch group
export const QUOTA_BYTES = ;

Press Ctrl⌘Enter to check your answer

Challenge 2

Reserve headroom for the header estimate the quota also charges.

js Your answer
export const SAFETY_MARGIN = ; // header + URL overhead
export const BUDGET = QUOTA_BYTES - SAFETY_MARGIN;

Press Ctrl⌘Enter to check your answer

Challenge 3

Release the charge when a request completes.

js Your answer
this.inFlight -= charge;
this.(); // try the refused queue again

Press Ctrl⌘Enter to check your answer

Challenge 4

Which return value means ONLY 'the quota refused this request'?

js Your answer
const queued = navigator.sendBeacon(url, body);
if (queued === ) enqueue(body); // quota overflow at queueing time

Press Ctrl⌘Enter to check your answer

Challenge 5

Name the accounting unit that owns the pool.

js Your answer
// one 64 KiB pool per ...
const scope = 'one per Document or Worker: the '

Press Ctrl⌘Enter to check your answer