Skip to the demo
Demos

Live & polling

The clock ticks from the server: a poll directive calls an action every two seconds and the component re-renders with fresh state — no client timer, no fetch. Pause it to stop the interval.

09:47:33

Server time · 1 ticks · uptime 0m 02supdating…

@locked now = "";
@locked ticks = 0;
@expose paused = false;

@expose tick() {
  this.now = new Date().toLocaleTimeString();
  this.ticks++;
}
@computed get uptime() {   // derived; renders as a static server value
  return `${this.ticks * 2}s`;
}

// poll calls the action on an interval → the component re-renders with fresh state
{!this.paused && <div poll={{ every: "2s", action: this.tick }} />}
<p>{this.now} · {this.ticks} ticks · uptime {this.uptime}</p>