RoomStoreMethods

See source code

Deprecated: use the storage.transaction method instead

Table of contents

Interface for making transactional changes to room store data. Used within updateStore transactions to modify documents atomically.

interface RoomStoreMethods<R extends UnknownRecord = UnknownRecord> {}

Example

await room.updateStore((store) => {
  const shape = store.get("shape:123");
  if (shape) {
    store.put({ ...shape, x: shape.x + 10 });
  }
  store.delete("shape:456");
});

Methods

delete

Delete a record from the store.

Parameters

NameDescription

recordOrId

R | string;

The record or record ID to delete

Returns

void;

get

Get a record by its ID.

Parameters

NameDescription

id

string;

The record ID

Returns

null | R;

The record or null if not found


getAll

Get all records in the store.


put

Add or update a record in the store.

Parameters

NameDescription

record

R;

The record to store

Returns

void;

Prev
RoomSnapshot
Next
SessionStateSnapshot