Design a Client-Side Event Batching System

Tests your grasp of client-side performance, network optimization, and data loss edge cases. A great answer batches events in memory, sends them with `fetch()`, and uses `navigator.sendBeacon()` on `pagehide` to reliably send the final batch.
This tests your ability to design a robust analytics system, balancing network efficiency with data integrity, specifically probing your knowledge of modern browser APIs for non-blocking requests during page termination. Outline an in-memory queue, periodic `fetch()` calls, and a `navigator.sendBeacon()` handler on `pagehide` or `visibilitychange` to guarantee delivery of the final batch. A common mistake is suggesting synchronous XHR on unload, which is deprecated and hurts UX.
Read the original → developer.mozilla.org
- #client-side
- #performance
- #analytics
- #browser apis
- #networking
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.