# @types/mock-raf

> TypeScript definitions for mock-raf

Latest version **1.0.6** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/mock-raf
pnpm add @types/mock-raf
yarn add @types/mock-raf
bun add @types/mock-raf
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2023-11-07 |
| First published | 2017-01-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51446 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/mock-raf
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mock-raf
- npm.io page: https://npm.io/package/@types/mock-raf

## Recent versions

- 1.0.6 (latest) — 2023-11-07
- 1.0.3 (ts3.6) — 2021-07-08
- 1.0.2 (ts2.0) — 2017-03-30
- 1.0.5 — 2023-10-18
- 1.0.4 — 2023-09-27
- 1.0.1 — 2017-02-23
- 1.0.0 — 2017-01-19

## README

# Installation
> `npm install --save @types/mock-raf`

# Summary
This package contains type definitions for mock-raf (https://github.com/FormidableLabs/mock-raf).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mock-raf.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mock-raf/index.d.ts)
````ts
declare namespace MockRaf {
    interface Options {
        /** The time that should pass during each requestAnimationFrame step in milliseconds. Default is roughly equivalent to default browser behavior. */
        time?: number | undefined;

        /** The number of steps to take. */
        count?: number | undefined;
    }

    /** Creates a mockRaf instance, exposing the functions you'll use to interact with the mock. */
    interface Creator {
        /**
         * Returns the current now value of the mock. Starts at 0 and increases with each step() taken.
         * Useful for stubbing out performance.now() or a polyfill when using requestAnimationFrame with timers.
         */
        now(): number;

        /** Replacement for requestAnimationFrame or a polyfill.Adds a callback to be fired on the next step. */
        raf(callback: FrameRequestCallback): number;

        /** Replacement for cancelAnimationFrame or a polyfill.Removes all currently scheduled requestAnimationFrame callbacks from the queue. */
        cancel(handle: number): void;

        /** Takes requestAnimationFrame steps. Fires currently queued callbacks for each step and increments now time for each step. The primary way to interact with a mockRaf instance for testing. */
        step(options?: Options): void;
    }
}

declare function MockRaf(): MockRaf.Creator;

export = MockRaf;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 09:09:39 GMT
 * Dependencies: none

# Credits
These definitions were written by [Daniel Pereira](https://github.com/djpereira).

---
_Source: https://npm.io/package/@types/mock-raf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
