Writes.of
function · packages/surface/src/writes.ts:115
of<
Root,
F extends Schema.Struct.Fields,
Cases extends Record<string, Schema.Struct.Fields>,
Transitions extends Readonly<Record<string, unknown>>,
>(
app: AppScope<Root, F, Cases>,
machine: Machine<Root, Transitions> & OnlyMessages<Cases, Transitions>,
options?: WritesOptions,
): Writes<
Root,
Schema.Schema.Type<MessageUnion<Cases>>,
keyof Transitions & string
>The writes of an application's Messages, from a metakit Machine over its
Model whose transitions are named by Message tags. Make each view with
its rootView, and wrap update with its track.
Example
ts
const writes = Writes.of(App, Machine.make({ state: Model, transitions: { Renamed, Counted } }))
const header = writes.rootView(Header, undefined, drawHeader)
const update = writes.track(appUpdate)