UNPKG

jest-wake-lock-mock

Version:

Mock Screen Wake Lock API `navigator.wakeLock` with ease and run your tests using Jest

21 lines (20 loc) 896 B
/// <reference types="dom-screen-wake-lock" /> declare const RELEASE_EVENT_NAME = "release"; declare type ReleaseEventName = typeof RELEASE_EVENT_NAME; /** * Create a `navigator.wakeLock.request` * @class * @classdesc Aims to reproduce Screen Wake Lock API in Jest environment * @link https://w3c.github.io/screen-wake-lock/ */ export declare class WakeLockSentinel { #private; constructor(type: WakeLockType); addEventListener(eventName: ReleaseEventName, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void; removeEventListener(eventName: ReleaseEventName, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void; release(): Promise<void>; set onrelease(listener: EventListener); get released(): boolean; get type(): "screen"; } export {};