# Class MockClock

#### Hierarchy

- Clock
  - MockClock

- Defined in src/test/utils/mocks/mockClock.ts:4

#####
Index

### Constructors

constructor

### Properties

now
paused
scene
startTime
systems
timeScale

### Methods

addEvent
clearPendingEvents
delayedCall
preUpdate
removeAllEvents
removeEvent
update

## Constructors

### constructor

- new MockClock(scene): MockClock

- #### Parameters

  - scene: any

  #### Returns MockClock

  Overrides Clock.constructor

  - Defined in src/test/utils/mocks/mockClock.ts:5

## Properties

### now

now: number

The current time of the Clock, in milliseconds.

If accessed externally, this is equivalent to the `time` parameter normally passed to a Scene's `update` method.

Inherited from Clock.now

- Defined in node_modules/phaser/types/phaser.d.ts:111451

### paused

paused: boolean

Whether the Clock is paused (`true`) or active (`false`).

When paused, the Clock will not update any of its Timer Events, thus freezing time.

Inherited from Clock.paused

- Defined in node_modules/phaser/types/phaser.d.ts:111472

### scene

scene: Scene

The Scene which owns this Clock.

Inherited from Clock.scene

- Defined in node_modules/phaser/types/phaser.d.ts:111439

### startTime

startTime: number

The time the Clock (and Scene) started, in milliseconds.

This can be compared to the `time` parameter passed to a Scene's `update` method.

Inherited from Clock.startTime

- Defined in node_modules/phaser/types/phaser.d.ts:111458

### systems

systems: Systems

The Scene Systems object of the Scene which owns this Clock.

Inherited from Clock.systems

- Defined in node_modules/phaser/types/phaser.d.ts:111444

### timeScale

timeScale: number

The scale of the Clock's time delta.

The time delta is the time elapsed between two consecutive frames and influences the speed of time for this Clock and anything which uses it, such as its Timer Events. Values higher than 1 increase the speed of time, while values smaller than 1 decrease it. A value of 0 freezes time and is effectively equivalent to pausing the Clock.

Inherited from Clock.timeScale

- Defined in node_modules/phaser/types/phaser.d.ts:111465

## Methods

### addEvent

- addEvent(config): TimerEvent

- Creates a Timer Event and adds it to this Clock at the start of the next frame.

  You can pass in either a `TimerEventConfig` object, from with a new `TimerEvent` will be created, or you can pass in a `TimerEvent` instance.

  If passing an instance please make sure that this instance hasn't been used before. If it has ever entered a 'completed' state then it will no longer be suitable to run again.

  Also, if the `TimerEvent` instance is being used by another Clock (in another Scene) it will still be updated by that Clock as well, so be careful when using this feature.

  #### Parameters

  - config: TimerEventConfig | TimerEvent

    The configuration for the Timer Event, or an existing Timer Event object.

  #### Returns TimerEvent

  Inherited from Clock.addEvent

  - Defined in node_modules/phaser/types/phaser.d.ts:111488

### clearPendingEvents

- clearPendingEvents(): this

- Clears and recreates the array of pending Timer Events.

  #### Returns this

  Inherited from Clock.clearPendingEvents

  - Defined in node_modules/phaser/types/phaser.d.ts:111504

### delayedCall

- delayedCall(delay, callback, args?, callbackScope?): TimerEvent

- Creates a Timer Event and adds it to the Clock at the start of the frame.

  This is a shortcut for #addEvent which can be shorter and is compatible with the syntax of the GreenSock Animation Platform (GSAP).

  #### Parameters

  - delay: number

    The delay of the function call, in milliseconds.

  - callback: Function

    The function to call after the delay expires.

  - `Optional` args: any[]

    The arguments to call the function with.

  - `Optional` callbackScope: any

    The scope (`this` object) to call the function with.

  #### Returns TimerEvent

  Inherited from Clock.delayedCall

  - Defined in node_modules/phaser/types/phaser.d.ts:111499

### preUpdate

- preUpdate(time, delta): void

- Updates the arrays of active and pending Timer Events. Called at the start of the frame.

  #### Parameters

  - time: number

    The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.

  - delta: number

    The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.

  #### Returns void

  Inherited from Clock.preUpdate

  - Defined in node_modules/phaser/types/phaser.d.ts:111525

### removeAllEvents

- removeAllEvents(): this

- Schedules all active Timer Events for removal at the start of the frame.

  #### Returns this

  Inherited from Clock.removeAllEvents

  - Defined in node_modules/phaser/types/phaser.d.ts:111518

### removeEvent

- removeEvent(events): this

- Removes the given Timer Event, or an array of Timer Events, from this Clock.

  The events are removed from all internal lists (active, pending and removal), freeing the event up to be re-used.

  #### Parameters

  - events: TimerEvent | TimerEvent[]

    The Timer Event, or an array of Timer Events, to remove from this Clock.

  #### Returns this

  Inherited from Clock.removeEvent

  - Defined in node_modules/phaser/types/phaser.d.ts:111513

### update

- update(time, delta): void

- Updates the Clock's internal time and all of its Timer Events.

  #### Parameters

  - time: number

    The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.

  - delta: number

    The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.

  #### Returns void

  Inherited from Clock.update

  - Defined in node_modules/phaser/types/phaser.d.ts:111532