Skip to content

KcdMp.mock.emit

Fires the page’s event handlers as if the game mode had sent the event.

Runs the handlers registered with KcdMp.onServer for name - and for "*" - with value and its text: a text is its own text, anything else is written as JSON.

KcdMp.mock.emit(name, value?)
Parameter Type
name string the event’s name
value unknown the payload (optional)

nothing

KcdMp.onServer("shop.items", (value) => render(value.items));
KcdMp.mock.emit("shop.items", { items: [{ id: "bread", price: 4 }] });

KcdMp.onServer · KcdMp.mock.message · the Mock mode group of the index