Skip to main content

StateDeclaration

interface

One piece of state your mod owns, declared at author time. This is the declaration, not the data. You list it in `defineMod`'s `state` slot and keep the value around to pass to `ctx.state(declaration)`, which is what hands you a live OwnedState handle you can read and write.

interface StateDeclaration<TValue = unknown>

Import

import { StateDeclaration } from '@modular/sdk';

Members8

__@runtimeContractInput@15821optional
TValue
id
StateDeclarationId

Identifier, unique within the mod.

initial
TValue

Value used the first time this state is registered.

kind
'state-declaration'
scope
ModStateScope

Whether the value persists per workspace or per profile.

sensitivity
DataSensitivity

How freely the host may share the value.

stability
DataStability

Compatibility promise you are making to readers of this state.

titleoptional
string

Human-readable label shown where the host lists mod state.