Skip to content
JDesk
Guides

Emitting events

Push data from Java to the frontend by emitting events.

Commands let the frontend call Java; events let Java push data back.

context.events().emit("download.progress", new Progress(pct));

Subscribe on the JS side:

import { on } from "jdesk-client";
const off = on("download.progress", (p) => { progressBar.value = p.pct; });

Each window has a bounded queue (256 events). Overflow policy: REJECT (default), DROP_OLDEST, or COALESCE.