saealib.core.StateView#

class saealib.core.StateView(store, reads, *, context=None, dispatch=None)[source]#

Bases: object

Read-only projection of a store for declared state keys.

Parameters:
  • store (StateStore)

  • reads (Iterable[StateKey] | StateContract)

  • context (object | None)

  • dispatch (Callable[[object], None] | None)

Methods

__init__

contains

Return presence for a declared key.

dispatch

Dispatch a component event through the bound runtime callback.

get

Return a declared value, making arrays read-only for the caller.

Method Details

StateView.__init__(store, reads, *, context=None, dispatch=None)[source]#
Parameters:
  • store (StateStore)

  • reads (Iterable[StateKey] | StateContract)

  • context (object | None)

  • dispatch (Callable[[object], None] | None)

Return type:

None

StateView.contains(key)[source]#

Return presence for a declared key.

Parameters:

key (StateKey)

Return type:

bool

StateView.dispatch(event)[source]#

Dispatch a component event through the bound runtime callback.

Parameters:

event (object)

Return type:

None

StateView.get(key)[source]#

Return a declared value, making arrays read-only for the caller.

Parameters:

key (StateKey[ValueT])

Return type:

ValueT