Skip to content

probe-web / @probe-web/devices / withProbeLock

Function: withProbeLock()

ts
function withProbeLock<T>(key, fn): Promise<T | null>;

Defined in: index.ts:113

Hold an exclusive cross-tab lock while using a probe. Chrome claims the USB interface per tab, so a second tab would otherwise fail with an opaque error. Resolves null immediately if another tab holds the lock; without the Web Locks API, fn runs unguarded. Build key with probeKey.

Type Parameters

Type Parameter
T

Parameters

ParameterType
keystring
fn() => Promise<T>

Returns

Promise<T | null>