Class CAAT.Foundation.Timer.TimerTask
Defined in: TimerTask.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
This callback will be called when the timer is cancelled.
|
|
This callback will be called whenever the timer is checked in time.
|
|
This callback will be called only once, when the timer expires.
|
|
Timer duration.
|
|
What TimerManager instance owns this task.
|
|
Remove this timer task on expiration/cancellation ?
|
|
Scene or director instance that owns this TimerTask owner.
|
|
Timer start time.
|
|
An arbitrry id.
|
Method Attributes | Method Name and Description |
---|---|
addTime(time)
|
|
cancel()
Cancels this timer by removing it on scene's next frame.
|
|
checkTask(time)
Performs TimerTask operation.
|
|
create(startTime, duration, callback_timeout, callback_tick, callback_cancel)
Create a TimerTask.
|
|
reset(time)
Reschedules this TimerTask by changing its startTime to current scene's time.
|
Field Detail
callback_cancel
This callback will be called when the timer is cancelled.
callback_tick
This callback will be called whenever the timer is checked in time.
callback_timeout
This callback will be called only once, when the timer expires.
duration
Timer duration.
owner
What TimerManager instance owns this task.
remove
Remove this timer task on expiration/cancellation ?
scene
Scene or director instance that owns this TimerTask owner.
startTime
Timer start time. Relative to Scene or Director time, depending who owns this TimerTask.
taskId
An arbitrry id.
Method Detail
addTime(time)
- Parameters:
- time
cancel()
Cancels this timer by removing it on scene's next frame. The function callback_cancel will
be called.
- Returns:
- this
checkTask(time)
Performs TimerTask operation. The task will check whether it is in frame time, and will
either notify callback_timeout or callback_tick.
- Parameters:
- time
- {number} an integer indicating scene time.
- Returns:
- this
create(startTime, duration, callback_timeout, callback_tick, callback_cancel)
Create a TimerTask.
The taskId will be set by the scene.
- Parameters:
- startTime
- {number} an integer indicating TimerTask enable time.
- duration
- {number} an integer indicating TimerTask duration.
- callback_timeout
- {function( sceneTime {number}, timertaskTime{number}, timertask {CAAT.TimerTask} )} on timeout callback function.
- callback_tick
- {function( sceneTime {number}, timertaskTime{number}, timertask {CAAT.TimerTask} )} on tick callback function.
- callback_cancel
- {function( sceneTime {number}, timertaskTime{number}, timertask {CAAT.TimerTask} )} on cancel callback function.
- Returns:
- this
remainingTime()
reset(time)
Reschedules this TimerTask by changing its startTime to current scene's time.
- Parameters:
- time
- {number} an integer indicating scene time.
- Returns:
- this