Computers · Program API v1.2.0
    Preparing search index...

    Function computer

    • Persist a value shared by all Programs on this computer's JournalEntry.

      Parameters

      • key: string

        A valid, distinctive state key, such as "example_visits".

      • value: JsonValue

        JSON-serializable data; undefined, functions, BigInt, and cycles cannot be stored as values.

      Returns Promise<JsonValue>

      An independent JSON copy of the saved value; rejects on validation/write failure or cancellation.

      A dispatched document write can still commit after cancellation. Load/change/save is not atomic.

      await save.computer("example_visits", (load.computer("example_visits") ?? 0) + 1);