GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • ADK for TypeScript: API Reference

This view

  • Original page
  • New address

GeezerVison is showing adk.dev — State | ADK for TypeScript: API Reference - v2.5.0

  • State

Class State

A state mapping that maintains the current value and the pending-commit delta.

  • Defined in core/src/sessions/state.ts:28

Constructors

constructor

  • new State(
        value?: Record<string, unknown>,
        delta?: Record<string, unknown>,
        schema?: SchemaLike,
    ): State

    Parameters

    • value: Record<string, unknown> = {}

      The current value of the state.

    • delta: Record<string, unknown> = {}

      The delta change to the current value that hasn't been committed.

    • Optionalschema: SchemaLike

      Declares the keys this state may hold and their types. When set, every mutation is checked against it; prefixed keys are exempt.

    Returns State

    • Defined in core/src/sessions/state.ts:33

Properties

Optional Readonlyschema

schema?: SchemaLike

Declares the keys this state may hold and their types. When set, every mutation is checked against it; prefixed keys are exempt.

  • Defined in core/src/sessions/state.ts:42

Static ReadonlyAPP_PREFIX

APP_PREFIX: "app:" = 'app:'
  • Defined in core/src/sessions/state.ts:29

Static ReadonlyTEMP_PREFIX

TEMP_PREFIX: "temp:" = 'temp:'
  • Defined in core/src/sessions/state.ts:31

Static ReadonlyUSER_PREFIX

USER_PREFIX: "user:" = 'user:'
  • Defined in core/src/sessions/state.ts:30

Methods

get

  • get<T>(key: string, defaultValue?: T): T | undefined

    Returns the value of the state dict for the given key.

    Only keys the state holds itself are found. Names inherited from Object.prototype, such as toString, are treated as missing.

    Type Parameters

    • T

    Parameters

    • key: string

      The key to get the value for.

    • OptionaldefaultValue: T

      The default value to return if the key is not found.

    Returns T | undefined

    The value of the state for the given key, or the default value if not found.

    • Defined in core/src/sessions/state.ts:103

has

  • has(key: string): boolean

    Whether the state holds the given key, either as a stored value or as a pending delta. Names inherited from Object.prototype are not keys.

    Parameters

    • key: string

    Returns boolean

    • Defined in core/src/sessions/state.ts:134

hasDelta

  • hasDelta(): boolean

    Whether the state has pending delta.

    Returns boolean

    • Defined in core/src/sessions/state.ts:141

set

  • set(key: string, value: unknown): void

    Sets the value of the state dict for the given key.

    Parameters

    • key: string

      The key to set the value for.

    • value: unknown

      The value to set.

    Returns void

    • Defined in core/src/sessions/state.ts:121

toRecord

  • toRecord(): Record<string, unknown>

    Returns the state as a plain JSON object.

    Returns Record<string, unknown>

    • Defined in core/src/sessions/state.ts:163

update

  • update(delta: Record<string, unknown>): void

    Updates the state dict with the given delta.

    Parameters

    • delta: Record<string, unknown>

      The delta to update the state with.

    Returns void

    • Defined in core/src/sessions/state.ts:150

validateDelta

  • validateDelta(delta: Record<string, unknown>): void

    Checks a whole delta against schema, for writes that reach the session without passing through this object — a node emitting an event that carries its own stateDelta.

    Parameters

    • delta: Record<string, unknown>

    Returns void

    • Defined in core/src/sessions/state.ts:50
Constructors
constructor
Properties
schemaAPP_PREFIXTEMP_PREFIXUSER_PREFIX
Methods
gethashasDeltasettoRecordupdatevalidateDelta
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.