Skip to main content

Type Alias: WebLockCallback<T>

WebLockCallback<T> = (lock, signal) => T | Promise<T>

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

The function run calls while holding the lock.

Type Parameters​

T​

T

Parameters​

lock​

Lock | null

The granted Lock, or null when the Web Locks API is not available and fn runs without a lock.

signal​

AbortSignal

Aborted when the component unmounts or the signal passed to run aborts. Pass it to fetch or check it in loops to stop early and free the lock sooner.

Returns​

T | Promise<T>