Repository

Time

Extends:

Component → Time

The Time class provides methods to control time related operations. One instance of this Component is created internnaly by the Context. It makes it possible to access and to use a global time in Components that require it (i.e Touch, Animation, etc.). In users script, this global Time can be accessed via the context.

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

the current time in ms

public

the time delta in ms

public

scale: *

public

Method Summary

Public Methods
public

absolute Delta

public

getDelta(): *

returns the diff between current time and past time

public

Delta converted in seconds

public

on()

Start the Time

public

resets this time instance

public

updates this time instance

Inherited Summary

From class Component
public
public
public

events: *

public

id: *

public

name: *

private

_nexts: *[]

private
public
public

chain(component: Component)

Adds a component to this chained component array

public

Returns the array of attached children components

public

off()

Deactivate the component

public

on()

Activate the component A call to this method calls the setup method if it has not been run yet

public

Run code after the update of all components is run This empty method is usually overriden to perform post-update actions for the component It is called periodically by an internal Mobilizing mechanism

public

preLoad the component This empty method is usually overriden to perform preLoad actions for the component.

public

Run code before the update of all components is run This empty method is usually overriden to perform pre-update actions for the component It is called once per component by an internal Mobilizing mechanism

public

prepare the component This empty method is usually overriden to perform preparation actions for the component, from external process as a server.

public

Set's up the component This empty method is usually overriden to perform setup actions for the component This is where all the initialization (such as adding event listeners)should be done It is called automatically by an internal Mobilizing mechanism and should thus not be called directly

public

Update the component This empty method is usually overriden to perform update actions for the component It is called periodically by an internal Mobilizing mechanism

Public Constructors

public constructor(params: Object) source

Override:

Component#constructor

Params:

NameTypeAttributeDescription
paramsObject

Parameters object, given by the constructor.

params.startTimeDate

the Date to start the time at

params.scaleNumber

this time's scale

Example:

   //TODO

Public Members

public currentTime: Number source

the current time in ms

public delta: Number source

the time delta in ms

public scale: * source

public startTime: * source

Public Methods

public getAbsoluteDelta(): Number source

absolute Delta

Return:

Number

absolute Delta in ms

public getDelta(): * source

returns the diff between current time and past time

Return:

*

delta in ms

public getDeltaSeconds(): Number source

Delta converted in seconds

Return:

Number

Delta in seconds

public on() source

Start the Time

Override:

Component#on

public reset() source

resets this time instance

public update() source

updates this time instance

Override:

Component#update