Skip to content

Interface: LocksStore

@roomful/svelte


@roomful/svelte / LocksStore

Defined in: packages/svelte/src/index.ts:410

Readable store of all held locks augmented with acquire/release helpers.

  • Readable<LockState[]>

getHolder: (key) => Peer<PresenceData> | null

Defined in: packages/svelte/src/index.ts:439

Returns the peer currently holding a key, or null.

Returns the peer currently holding key, or null when the lock is free.

string

The lock key to resolve.

Peer<PresenceData> | null

The holding peer, or null.


isLocked: (key) => boolean

Defined in: packages/svelte/src/index.ts:434

Reports whether a key is currently held by any peer.

Reports whether key is currently held by any peer (including the local peer).

string

The lock key to test.

boolean

true when the key has a non-expired holder.


release: (key) => void

Defined in: packages/svelte/src/index.ts:424

Releases a lock held by the local peer.

Releases a lock held by the local peer. No-op when the local peer does not hold key.

string

The lock key to release.

void

Nothing.


releaseAll: () => void

Defined in: packages/svelte/src/index.ts:429

Releases every lock held by the local peer.

Releases every lock currently held by the local peer.

void

Nothing.

acquire(key, options?): Promise<boolean>

Defined in: packages/svelte/src/index.ts:419

Claims exclusive ownership of a key, resolving whether the local peer holds it.

string

The lock key to claim.

LockAcquireOptions

Optional TTL and acquire-timeout configuration.

Promise<boolean>

A promise resolving to whether the local peer holds the key.


subscribe(this, run, invalidate?): Unsubscriber

Defined in: node_modules/.pnpm/svelte@4.2.20/node_modules/svelte/types/index.d.ts:1619

Subscribe on value changes.

void

Subscriber<LockState[]>

subscription callback

Invalidator<LockState[]>

cleanup callback

Unsubscriber

Readable.subscribe