Class: Timer

system.process. Timer


new Timer( [delay] [, repeatCount] [, useSeconds])

The Timer objects which let you run code on a specified time sequence.

The Timer objects which let you run code on a specified time sequence. This timer object use an internal setInterval function to calls or evaluates an expression at specified intervals

Parameters:
Name Type Argument Default Description
delay number <optional>
0

The delay in ms or in seconds if the useSeconds property is true. If this value is 0, the timer emit with the minimum delay possible.

repeatCount number <optional>
0

Indicates the number or repeat of the timer, if the repeatCount value is > 0/.

useSeconds boolean <optional>
false

Specifies if the timer use a delay in seconds or not.

Example
var finish = function( action )
{
    trace( action + " finish" ) ;
}

var resume = function( action )
{
    trace( action + " resume" ) ;
}

var start = function( action )
{
    trace( action + " start" ) ;
}

var stop = function( action )
{
    trace( action + " stop" ) ;
}

var time = function( action )
{
    trace( action + " count: " + action.currentCount + " / " + action.repeatCount ) ;
    if ( action.currentCount === 5 )
    {
        action.stop() ;
        trace( "timer stopped:" + action.stopped ) ;
        action.resume() ;
    }
}

var action = new system.process.Timer( 1000 , 10 ) ;
//var action = new system.process.Timer( 1 , 10 , true ) ; // use the useSeconds flag

action.finishIt.connect( finish ) ;
action.progressIt.connect( time ) ;
action.resumeIt.connect( resume ) ;
action.startIt.connect( start ) ;
action.stopIt.connect( stop ) ;

action.run() ;

Extends

Members


<constant> changeIt :system.signals.Signal

The signal emit when the task is changed.

Type:
Inherited From:

<constant> clearIt :system.signals.Signal

The signal emit when the task is cleared.

Type:
Inherited From:

<readonly> currentCount :number

The current count value if the timer use the repeatCount option.

Type:
  • number

delay :number

Indicates the delay between timer events, in milliseconds (or seconds it the useSeconds is true).

Type:
  • number

<constant> finishIt :system.signals.Signal

This signal emit when the action is finished.

Type:
Inherited From:

<constant> infoIt :system.signals.Signal

The signal emit when the task emit a message.

Type:
Inherited From:

looping :boolean

The flag to determinate if the task must be looped.

Type:
  • boolean
Inherited From:
Default Value:
  • false

<constant> loopIt :system.signals.Signal

The signal emit when the task is looped.

Type:
Inherited From:

<constant> pauseIt :system.signals.Signal

The signal emit when the task is paused.

Type:
Inherited From:

<readonly> phase :string

Indicates the current phase.

Type:
  • string
Inherited From:
See:

<constant> progressIt :system.signals.Signal

The signal emit when the task is in progress.

Type:
Inherited From:

repeatCount :boolean

Indicates the number of repetitions. If zero, the timer repeats infinitely. If nonzero, the timer runs the specified number of times and then stops.

Type:
  • boolean

<constant> resumeIt :system.signals.Signal

The signal emit when the task is resumed.

Type:
Inherited From:

<readonly> running :boolean

Indicates action is running.

Type:
  • boolean
Inherited From:

<constant> startIt :system.signals.Signal

This signal emit when the action is started.

Type:
Inherited From:

<constant> stopIt :system.signals.Signal

This signal emit when the task is stopped.

Type:
Inherited From:

<readonly> stopped :boolean

Indicates true if the timer is stopped.

Type:
  • boolean

<constant> timeoutIt :system.signals.Signal

The signal emit when the task is out of time.

Type:
Inherited From:

useSeconds :boolean

Indicates if the timer delaty is in seconds or in milliseconds (default milliseconds).

Type:
  • boolean

Methods


clone()

Returns a shallow copy of this object.

Overrides:
Returns:

a shallow copy of this object.


isLocked()

Returns true if the object is locked.

Inherited From:
Implements:
Returns:

true if the object is locked.


lock()

Locks the object.

Inherited From:
Implements:

notifyChanged()

Notify when the process is changed.

Inherited From:

notifyCleared()

Notify when the process is cleared.

Inherited From:

notifyFinished()

Notify when the process is finished.

Inherited From:

notifyInfo()

Notify a specific information when the process is changed.

Inherited From:

notifyLooped()

Notify when the process is looped.

Inherited From:

notifyPaused()

Notify when the process is paused.

Inherited From:

notifyProgress()

Notify when the process is progress.

Inherited From:

notifyResumed()

Notify when the process is resumed.

Inherited From:

notifyStarted()

Notify when the process is started.

Inherited From:

notifyStopped()

Notify when the process is stopped.

Inherited From:

notifyTimeout()

Notify when the process is out of time.

Inherited From:

reset()

Reset the timer and stop it before if it's running.

Overrides:

resume()

Restarts the timer. The timer is stopped, and then started.

Overrides:

run()

Run the timer.

Overrides:

start()

Starts the task.

Inherited From:
Implements:

stop()

Stops the timer.

Overrides:

unlock()

Unlocks the object.

Inherited From:
Implements: