# Lolex [![Build Status](https://travis-ci.org/sinonjs/lolex.svg?branch=master)](https://travis-ci.org/sinonjs/lolex) JavaScript implementation of the timer APIs; `setTimeout`, `clearTimeout`, `setImmediate`, `clearImmediate`, `setInterval`, `clearInterval`, `requestAnimationFrame`, `cancelAnimationFrame`, `requestIdleCallback`, and `cancelIdleCallback`, along with a clock instance that controls the flow of time. Lolex also provides a `Date` implementation that gets its time from the clock. In addition in browser environment lolex provides a `performance` implementation that gets its time from the clock. In Node environments lolex provides a `nextTick` implementation that is synchronized with the clock - and a `process.hrtime` shim that works with the clock. Lolex can be used to simulate passing time in automated tests and other situations where you want the scheduling semantics, but don't want to actually wait (however, from version 2.0 lolex supports those of you who would like to wait too). Lolex is extracted from [Sinon.JS](https://github.com/sinonjs/sinon.js) and targets the [same runtimes](https://sinonjs.org/releases/latest/#supported-runtimes). ## Installation Lolex can be used in both Node and browser environments. Installation is as easy as ```sh npm install lolex ``` If you want to use Lolex in a browser you can use [the pre-built version](https://github.com/sinonjs/lolex/blob/master/lolex.js) available in the repo and the npm package. Using npm you only need to reference `./node_modules/lolex/lolex.js` in your `