BPS Script API  2.24.4
bps::Timer Class Reference

The Timer class provides repetitive and single-shot timers. More...

Signals

void timeout ()
 Signal emitted when the timer times out.
 

Public Member Functions

void start (Number aMillisecs)
 Starts or restarts the timer with a timeout interval of msec milliseconds. More...
 
void stop ()
 Stops the timer.
 
 Timer ()
 Constructor.
 

Properties

Boolean active
 True if the timer is running. More...
 
Number interval
 This property holds the timeout interval in milliseconds. More...
 
Boolean singleShot
 This property holds whether the timer is a single-shot timer. More...
 

Detailed Description

The Timer class provides repetitive and single-shot timers.

Example use of the Timer class:

function hello()
{
print('hello!');
}
var timer = new bps.Timer;
timer.singleShot = true;
timer.timeout.connect(hello);
timer.start();
void print(...)
Print the expressions (applying toString() if necessary) to the console standard output (stdout),...
The Timer class provides repetitive and single-shot timers.
Definition: bps.Timer.js:20
Boolean singleShot
This property holds whether the timer is a single-shot timer.
Definition: bps.Timer.js:37
The bps extension is a namespace assembling general BPS properties and functions.
Definition: bps.AsyncIO.js:1

Member Function Documentation

◆ start()

void bps::Timer::start ( Number  aMillisecs)

Starts or restarts the timer with a timeout interval of msec milliseconds.

Starts or restarts the timer with the timeout specified in interval if no parameter is passed, or the time passed as parameter. If singleShot is true, the timer will be activated only once.

Parameters
aMillisecsTimeout interval.

Property Documentation

◆ active

Boolean bps::Timer::active
read

True if the timer is running.

 

◆ interval

Number bps::Timer::interval
readwrite

This property holds the timeout interval in milliseconds.

The default value for this property is 0. A Timer with a timeout interval of 0 will time out as soon as all the events in the window system's event queue have been processed.

◆ singleShot

Boolean bps::Timer::singleShot
readwrite

This property holds whether the timer is a single-shot timer.

A single-shot timer fires only once, non-single-shot timers fire every interval milliseconds.


The documentation for this class was generated from the following file: