Class cc.Timer
- Defined in: CCScheduler.js
- Extends cc.Class
Constructor Attributes | Constructor Name and Description |
---|---|
cc.Timer()
Light weight timer
|
Method Summary
Class Detail
cc.Timer()
Light weight timer
Method Detail
-
ctor()cc.Timer's Constructor Constructor
-
{Number} getInterval()returns interval of timer
- Returns:
- {Number}
-
{String|function} getSelector()returns selector
- Returns:
- {String|function}
-
{Boolean} initWithTarget(target, selector, seconds, repeat, delay)Initializes a timer with a target, a selector and an interval in seconds.
- Parameters:
- {cc.Class} target
- target
- {String|function} selector
- Selector
- {Number} seconds Optional, Default: 0
- second
- {Number} repeat Optional, Default: cc.REPEAT_FOREVER
- repeat times
- {Number} delay Optional, Default: 0
- delay
- Returns:
- {Boolean} true if initialized *
-
setInterval(interval)set interval in seconds
- Parameters:
- {Number} interval
-
Allocates a timer with a target, a selector and an interval in seconds.
- Parameters:
- {cc.Class} target
- {String|function} selector
- Selector
- {Number} seconds
- Returns:
- {cc.Timer} a cc.Timer instance
-
update(dt)triggers the timer
- Parameters:
- {Number} dt
- delta time