← All examples

Out-of-band updates

One request, three regions. The server returns a main fragment plus elements marked minu-oob; Minu applies those first, then swaps the main target.

Updating… Cart: 0

Main panel — updated by the primary swap.

The response

<!-- server response -->
<p>Main panel updated at 12:00:01.</p>

<span id="cart-count" minu-oob="#cart-count">1</span>
<div class="toast" minu-oob="beforeend:#toasts">Item added</div>

How it works

  1. The button requests /demo/oob and targets #oob-main.
  2. Minu parses the whole response into a template.
  3. Elements with minu-oob are applied to their selectors and removed from the payload.
  4. minu-oob="#cart-count" defaults to outerHTML.
  5. minu-oob="beforeend:#toasts" appends the toast to the list.
  6. The remaining HTML does the normal innerHTML swap into #oob-main.

An OOB-only response leaves the main target untouched. OOB mode is optional: minu-oob="beforeend:#toasts", minu-oob="afterbegin:#list", and the other swap modes work.