Installation
npm install --save @types/web-locks-api
Summary
This package contains type definitions for web-locks-api (https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_API).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/web-locks-api.
index.d.ts
interface Lock {
readonly mode: "exclusive" | "shared";
readonly name: string;
}
interface LockInfo {
clientId?: string;
mode?: "exclusive" | "shared";
name?: string;
}
interface LockManagerSnapshot {
held?: LockInfo[] | undefined;
pending?: LockInfo[] | undefined;
}
interface LockManagerRequestOptions {
mode?: "exclusive" | "shared" | undefined;
ifAvailable?: boolean | undefined;
steal?: boolean | undefined;
signal?: AbortSignal | undefined;
}
interface LockManager {
request(name: string, callback: (lock: Lock) => Promise<any>): Promise<undefined>;
request<T extends LockManagerRequestOptions>(
name: string,
options: T,
callback: (lock: T["ifAvailable"] extends true ? Lock | null : Lock) => Promise<any>,
): Promise<undefined>;
query(): Promise<LockManagerSnapshot>;
}
interface Navigator {
locks: LockManager;
}
Additional Details
- Last updated: Tue, 07 Nov 2023 15:11:36 GMT
- Dependencies: none
Credits
These definitions were written by Joël Charles.