WebLocksService

Coordinates exclusive or shared access to a named resource across tabs and workers using the Web Locks API. Useful for preventing concurrent operations on shared resources.

TypeScriptexample.ts
import { WebLocksService } from '@angular-helpers/browser-web-apis'

# Methods

MethodSignatureReturnsDescription
isSupportedisSupported(): booleanbooleanPublic method isSupported.
acquireacquire(name: string, callback: () => Promise<T> | T, options: LockOptionsLike): Promise<T>Promise<T>Acquire a lock and run the callback while holding it. The lock is released automatically when the callback resolves or rejects.
queryquery(): Promise<LockManagerSnapshot>Promise<LockManagerSnapshot>Query the current lock state. Useful for diagnostics and tests; do not gate critical-section logic on this — it's a snapshot, not a reservation.
LCP N/A
CLS N/A
INP N/A