Skip to main content

Interface: UseWebLockReturn

Defined in: use-web-lock.ts:51

Value returned by useWebLock.

Properties​

isHeld​

isHeld: boolean

Defined in: use-web-lock.ts:65

true while fn runs holding the lock from at least one run call.


isPending​

isPending: boolean

Defined in: use-web-lock.ts:67

true while at least one run call is waiting for the lock to be granted.


run​

run: <T>(fn, options?) => Promise<T | undefined>

Defined in: use-web-lock.ts:60

Waits for the lock, runs fn while holding it, and releases the lock once fn settles, whether it resolves or rejects. Resolves with the value fn returns, or undefined if ifAvailable skipped the work. Rejects with whatever fn throws, or with an AbortError if the request was aborted (see isAbortError). It keeps a stable identity until name changes.

Type Parameters​

T​

T

Parameters​

fn​

WebLockCallback<T>

options?​

UseWebLockRunOptions

Returns​

Promise<T | undefined>