DefinitelyTyped/types/requestidlecallback/index.d.ts
teramotodaiki 6269c2d818 [requestidlecallback] export "request" instead (#38688)
* [requestidlecallback] export "request" instead

aFarkas's requestIdleCallback polyfill does not export as "requestIdleCallback". It's "request" and "cancel".

18e7d0036d/index.js (L209-L212)

* format

* add line break to "Definitions by"

I followed below:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#edit-an-existing-package
2019-10-03 14:31:56 -07:00

30 lines
1.1 KiB
TypeScript

// Type definitions for requestidlecallback 0.3
// Project: https://w3c.github.io/requestidlecallback/, https://github.com/afarkas/requestidlecallback
// Definitions by: 贺师俊 <https://github.com/hax>
// Vladimir Grenaderov <https://github.com/VladimirGrenaderov>
// Max Boguslavskiy <https://github.com/maxbogus>
// Teramoto Daiki <https://github.com/teramotodaiki>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function request(callback: IdleRequestCallback, options?: IdleRequestOptions): IdleCallbackHandle;
export function cancel(handle: IdleCallbackHandle): void;
export type DOMHighResTimeStamp = number;
export type IdleCallbackHandle = number;
export type IdleRequestCallback = (deadline: IdleDeadline) => void;
export interface IdleDeadline {
timeRemaining(): DOMHighResTimeStamp;
readonly didTimeout: boolean;
}
export interface IdleRequestOptions {
timeout: number;
}
export interface Window {
requestIdleCallback(callback: IdleRequestCallback, options?: IdleRequestOptions): IdleCallbackHandle;
cancelIdleCallback(handle: number): void;
}