what

Live Content

Fetch HTML from the server and inject it into the page without a full reload.

Basic Injection (Replace)

Click the button to fetch server-rendered content and replace the target area.

Server time will appear here...

Append Mode

Each click appends a new notification to the end of the list.

Notifications will be appended here...

Prepend Mode

New content is inserted at the beginning of the target, pushing older items down.

Items will be prepended here...

Counter via Partial Swap

The counter is stored in the session and updates reactively through live injection.

Counter:

Add & Clear Notifications

Add notifications to the list, or clear them all at once. Both operations happen without leaving the page.

Content will appear here...

Polling with <what-fetch>

This region refreshes itself every 5 seconds — one tag, no timers to write. Polling pauses while the tab is hidden.

<what-fetch url="/w-partial/time" poll="5s"/>

First refresh in a few seconds…

Lazy Loading (fetch when visible)

This region only fetches the first time it scrolls into view — watch the timestamp: it's the moment you scrolled here, not page load.

<what-fetch url="/w-partial/time" when="visible">Loading…</what-fetch>

Loading…

Real-Time Updates

Need server-pushed updates without polling? Wired variables broadcast over WebSocket and every w-bind element updates instantly — across pages and browsers.

How It Works

Live Content Injection
This page demonstrates live content injection without full page reloads. Each button uses w-get to fetch a partial template from the server, w-target to select the destination element, and w-swap to control insertion mode (replace, append, or prepend). Session state persists across requests, enabling counters and notification lists that survive interactions.

Source

Loading...