UNPKG

material-motion-testing-utils

Version:
18 lines (17 loc) 581 B
export interface MockRAF { now(): number; raf: typeof requestAnimationFrame; cancel: typeof cancelAnimationFrame; step(options?: { time?: number; count?: number; }): void; } export declare type MockedRAFClosure = (mockRAF: MockRAF) => void; /** * Replaces `window.requestAnimationFrame`, `performance.now`, and `Date.now` * with mocks for the duration of a mocha testing suite. * * The two `now` methods will only be incremented when `mockRAF.step` is called. */ export default function useMockedRAF(closure: MockedRAFClosure): () => void;