0.0.5 • Published 6 months ago

@types/web-locks-api v0.0.5

Weekly downloads
13
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/web-locks-api

Summary

This package contains type definitions for web-locks-api-browser (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

// Type definitions for non-npm package web-locks-api-browser 0.0
// Project: https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_API
// Definitions by: Joël Charles <https://github.com/magne4000>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

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: Mon, 31 Jan 2022 20:01:29 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Joël Charles.

0.0.3

8 months ago

0.0.5

6 months ago

0.0.4

7 months ago

0.0.2

2 years ago

0.0.1

3 years ago

0.0.0

4 years ago