Episode 13 game · Raiden · Lightning

Raiden’s Throttle

Kai’s search box calls fetch on every keystroke, and his scroll progress bar runs on every scroll event. Feel the Storm of Requests, choose debounce or throttle for each handler, then prove that one word sends one request and the bar still moves while you scroll.

RaidenCount the bolts, Kai. Type into your search box and watch how many requests leave the browser.
13Seal 13
kai.app/library

Search handler: search(e.target.value)

Scroll progress
0 handler calls
Network · Fetch/XHR every request the search box sends

    0 / 0 requests

    1 · Feel the storm

    Type Kai’s word into his search box, then scroll his page for two seconds. Watch the requests and the handler calls pile up.

    Every key is a bolt

    The input event fires on every change, so calling fetch there sends one request per letter.

    Debounce waits for quiet

    Each call restarts the timer. It runs once, about 300 ms after the user stops, with the latest value.

    Throttle keeps a beat

    At most one call per interval while the user keeps going: right for scroll, drag and pointer moves.