Interface WebxdcUpdateItemCodec<I>

Source
Expand description

The webxdc update log wants JSON.

We can define a way to convert a single item into a JSON object and back.

interface WebxdcUpdateItemCodec<I extends Item> {
    key: I["type"];
    decode(payload: Record<string, string | undefined>): I | undefined;
    encode(item: I): Record<string, string>;
}

Properties§

§key: I["type"]

The item type this codec handles.

Methods§

Source§

decode(payload: Record<string, string | undefined>): I | undefined

Decode what is received via the handler registered by webxdc setUpdateListener

Source§

encode(item: I): Record<string, string>

Encode that is sent by webxdc sendUpdate()