@types/web-locks-api
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/web-locks-api

Weekly Downloads

4,041

Version

0.0.5

License

MIT

Unpacked Size

4.45 kB

Total Files

5

Last publish

Collaborators

  • types