_From @bsvipas on January 19, 2018 7:0_
There's no suggestion for window.requestIdleCallback (rIC) only for window.requestAnimationFrame (rAF).
_Copied from original issue: Microsoft/vscode#41850_
We don't include experimental APIs in lib.d.ts
@RyanCavanaugh 馃槩
Too bad.
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Posting this here for people who want to copy/paste into their projects:
type RequestIdleCallbackHandle = any;
type RequestIdleCallbackOptions = {
timeout: number;
};
type RequestIdleCallbackDeadline = {
readonly didTimeout: boolean;
timeRemaining: (() => number);
};
declare global {
interface Window {
requestIdleCallback: ((
callback: ((deadline: RequestIdleCallbackDeadline) => void),
opts?: RequestIdleCallbackOptions,
) => RequestIdleCallbackHandle);
cancelIdleCallback: ((handle: RequestIdleCallbackHandle) => void);
}
}
Most helpful comment
Posting this here for people who want to copy/paste into their projects: