foo-webview-sdk
    Preparing search index...

    Variable sharedStateConst

    sharedState: {
        delete: (key: string) => Promise<StateDeleteResponse>;
        get: (key: string) => Promise<StateGetResponse>;
        keys: (pattern?: string) => Promise<StateKeysResponse>;
        onChange: (handler: (data: unknown) => void) => () => void;
        onDelete: (handler: (data: unknown) => void) => () => void;
        set: (
            key: string,
            value: JsonValue,
            silent?: boolean,
            ttlMs?: number,
        ) => Promise<StateSetResponse>;
    } = ...

    sharedState — cross-window key/value state store.

    Distinct from state (the reactive playback mirror): this is a shared persistent / TTL-bound key/value bag with change events. Events use the state:* colon namespace.

    Type Declaration

    • delete: (key: string) => Promise<StateDeleteResponse>

      Remove a key from the shared state store.

    • get: (key: string) => Promise<StateGetResponse>

      Read a value from the cross-window shared state store by key.

    • keys: (pattern?: string) => Promise<StateKeysResponse>

      List keys in the shared state store matching an optional glob pattern.

    • onChange: (handler: (data: unknown) => void) => () => void

      Subscribe to shared state change events. Returns an unsubscribe function.

    • onDelete: (handler: (data: unknown) => void) => () => void

      Subscribe to shared state deletion events. Returns an unsubscribe function.

    • set: (
          key: string,
          value: JsonValue,
          silent?: boolean,
          ttlMs?: number,
      ) => Promise<StateSetResponse>

      ttlMs is the lifetime in milliseconds. null is not a value; remove a key with sharedState.delete instead.