Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

processLock

Implements a global exclusive lock that works only in the current process. Useful for environments like React Native or other non-browser single-process (i.e. no concept of "tabs") environments.

Use {@link #navigatorLock} in browser environments.

function processLock<R>(
name: string,
acquireTimeout: number,
fn: () => Promise<R>,
): Promise<R>;
§
processLock<R>(name: string, acquireTimeout: number, fn: () => Promise<R>): Promise<R>
[src]

§Type Parameters

§Parameters

§
name: string
[src]

Name of the lock to be acquired.

§
acquireTimeout: number
[src]

If negative, no timeout. If 0 an error is thrown if the lock can't be acquired without waiting. If positive, the lock acquire will time out after so many milliseconds. An error is a timeout if it has isAcquireTimeout set to true.

§
fn: () => Promise<R>
[src]

The operation to run once the lock is acquired.

§Return Type

§
Promise<R>
[src]