Design a client-side event batching system for a high-traffic app

This tests your grasp of frontend performance and data reliability. Outline a batching strategy (timer/size), then explain using `visibilitychange` with `navigator.sendBeacon()` to prevent data loss on unload. A red flag is suggesting synchronous XHR.
This tests your knowledge of frontend performance optimization and reliable data transmission. A strong answer outlines a batching strategy (collecting events and sending on a timer or size threshold), then addresses the critical data loss problem on page unload. You should propose using the `visibilitychange` event to trigger a final, reliable dispatch using `navigator.sendBeacon()`. A major red flag is suggesting synchronous XHR on unload, which blocks the UI, or failing to handle the unload case at all.
Read the original → developer.mozilla.org
- #frontend
- #performance
- #browser-apis
- #analytics
- #system-design
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.