Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

ReadonlyStore

A store a game reads, as a hook or with getState and subscribe, and the engine alone writes: every state it hands out is read-only.

Type Parameter
State

ReadonlyStore(): Readonly<State>

A store a game reads, as a hook or with getState and subscribe, and the engine alone writes: every state it hands out is read-only.

Readonly<State>

ReadonlyStore<Selected>(selector): Selected

A store a game reads, as a hook or with getState and subscribe, and the engine alone writes: every state it hands out is read-only.

Type Parameter
Selected
Parameter Type
selector (state) => Selected

Selected

Property Type
getInitialState () => Readonly<State>
getState () => Readonly<State>
subscribe (listener) => () => void