JsUnit

## Class Clock

    Object
       |
       +--Clock

class Clock

Clock stores callbacks and executes them when it is told to simulate the advancing of time
Defined in jsUnitMockTimeout.js

Field Summary
`<static> Object` | `nowMillis` The current milliseconds
`<static> Object` | `scheduledFunctions` Hash of milliseconds to scheduled functions
`<static> Object` | `timeoutsMade` The number of timeouts executed

Constructor Summary
`Clock()`

Method Summary
`<static> void` | `reset()` Resets the clock - clears the scheduledFunctions, the current milliseconds, and the timeouts made count
`<static> void` | `scheduleFunction(timeoutKey, funcToCall, millis, recurring)` Schedules a function to be executed at the given number of milliseconds from now
`<static> void` | `tick(millis)` Simulate the advancing of time.

Field Detail

### nowMillis

    <static> Object nowMillis

The current milliseconds

### scheduledFunctions

    <static> Object scheduledFunctions

Hash of milliseconds to scheduled functions

### timeoutsMade

    <static> Object timeoutsMade

The number of timeouts executed

Constructor Detail

### Clock

    Clock()

Method Detail

### reset

    <static> void reset()

Resets the clock - clears the scheduledFunctions, the current milliseconds, and the timeouts made count

### scheduleFunction

    <static> void scheduleFunction(timeoutKey, funcToCall, millis, recurring)

Schedules a function to be executed at the given number of milliseconds from now

Parameters:

`timeoutKey` - - the ID of the callback

`funcToCall` - - the function to call

`millis` - - the number of milliseconds before the callback

`recurring` - - whether the callback recurs - if true, then the callback will be re-registered after it executes

### tick

    <static> void tick(millis)

Simulate the advancing of time. Any functions scheduled in the given interval will be executed

Parameters:

`millis` - the number of milliseconds by which to advance time

JsUnit

www.jsunit.net
Documentation generated by JSDoc on Sun Sep 9 15:34:58 2007