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

trait

trait(schema?): TagTrait

A trait no dump, stream or checkpoint names: state a world keeps for itself, such as a list a room’s system rebuilds each step, or a behaviour’s record, which defineBehaviour names. State a page draws, a save keeps or the devtools show uses defineTrait, which names it. Its writes take the writer any trait’s do; with no reach declared, a write reads it as streamed, the strictest. With no schema it is a tag. As koota’s own trait.

Parameter Type
schema? Record<string, never>

TagTrait

trait<S>(schema, options?): Trait<Norm<S>>

A trait no dump, stream or checkpoint names: state a world keeps for itself, such as a list a room’s system rebuilds each step, or a behaviour’s record, which defineBehaviour names. State a page draws, a save keeps or the devtools show uses defineTrait, which names it. Its writes take the writer any trait’s do; with no reach declared, a write reads it as streamed, the strictest. With no schema it is a tag. As koota’s own trait.

Type Parameter
S extends Schema
Parameter Type
schema S
options? ScratchTraitOptions<keyof TraitRecord<S> & string>

Trait<Norm<S>>