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.
Syntax
Section titled “Syntax”KcdMp.mock.emit(name, value?)| Parameter | Type | |
|---|---|---|
name |
string |
the event’s name |
value |
unknown |
the payload (optional) |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”KcdMp.onServer("shop.items", (value) => render(value.items));KcdMp.mock.emit("shop.items", { items: [{ id: "bread", price: 4 }] });See also
Section titled “See also”KcdMp.onServer · KcdMp.mock.message · the Mock mode group of the index
