Skip to main content

Interface: UseWebLockRunOptions

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

Per-call options for the run function returned by useWebLock.

Extends​

Properties​

ifAvailable?​

optional ifAvailable?: boolean

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

If the lock cannot be granted immediately, skip the work: fn is not called and run resolves undefined. Default is false.

Inherited from​

UseWebLockOptions.ifAvailable


mode?​

optional mode?: LockMode

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

"exclusive" lets one holder at a time own the lock, "shared" lets any number of holders own it together. Default is "exclusive".

Inherited from​

UseWebLockOptions.mode


signal?​

optional signal?: AbortSignal

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

Aborts the call. While the lock is still being waited for, run rejects with the signal's reason. Once the lock is held, fn receives an AbortSignal that follows this one. Ignored by the browser, but still forwarded to fn, when ifAvailable or steal is set.


steal?​

optional steal?: boolean

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

Release any lock with the same name held in this origin and grant this request right away. The previous holder's run rejects with an AbortError. Needs "exclusive" mode. Default is false.

Inherited from​

UseWebLockOptions.steal