Skip to content

Instantly share code, notes, and snippets.

@madeinfree
Created February 12, 2019 04:47
Show Gist options
  • Save madeinfree/a6c877670b6e5a003332f225f0b31824 to your computer and use it in GitHub Desktop.
Save madeinfree/a6c877670b6e5a003332f225f0b31824 to your computer and use it in GitHub Desktop.
declare IdleCallback
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment