← All examples

Polling

The panel refreshes from /demo/time every 2 seconds. Switch browser tabs for a few seconds — polling pauses while the document is hidden, then resumes.

every 2s Fetching…

Waiting for the first poll…

How it works

  1. every 2s creates one interval when the element is initialized.
  2. On each tick, Minu calls the same request pipeline used by clicks and loads.
  3. The response replaces the contents of #poll-panel.
  4. If document.hidden is true, that tick is skipped instead of queued.
  5. minu.destroy() clears the interval and aborts any request in flight.
<div minu-get="/demo/time"
     minu-trigger="every 2s"
     minu-target="#poll-panel">
    <div id="poll-panel">Waiting…</div>
</div>

Polling is one request per tick. For high-frequency data, use SSE from the live example instead.