DefinitelyTyped/types/requestidlecallback/requestidlecallback-tests.ts
Max Boguslavsky 1e76cc036f Added window interface and tests to requestidlecallback: Part 2 (#38124)
* added tests and updated requestidlecallback type

* added tests and updated requestidlecallback type

* - corrected arguments according to feedback.
2019-09-23 15:37:12 -07:00

18 lines
482 B
TypeScript

import {
requestIdleCallback,
cancelIdleCallback,
IdleRequestOptions,
IdleCallbackHandle,
} from 'requestidlecallback';
// Test requestIdleCallback with default param
requestIdleCallback(() => '1');
// Test requestIdleCallback with default param and optional param
const option: IdleRequestOptions = { timeout: 2000 };
requestIdleCallback(() => '2', option);
// Test cancelIdleCallback with default param
const handle: IdleCallbackHandle = 1;
cancelIdleCallback(handle);