ProcessInterval

Representing a loop process based on the setInterval (native JS method).

Constructor

new ProcessInterval(optionsopt)

Create a new ProcessInterval.

Parameters:
NameTypeAttributesDefaultDescription
optionsobject<optional>
{}

Options of the process.

Properties
NameTypeAttributesDefaultDescription
fpsnumber<optional>
60

Frame rate per second of the process.

Members

fps :number

Frame rate per second of the process.

Type:
  • number

pause :boolean

If true, the process is paused and ProcessIntervalTickRequesters are not called.

Type:
  • boolean

tickRequesters :Array.<ProcessIntervalTickRequester>

Buffer of ProcessIntervalTickRequesters.

Methods

addtickRequester(cb)

Add a new ProcessIntervalTickRequester to the list.

Parameters:
NameTypeDescription
cbProcessIntervalTickRequester

The ProcessIntervalTickRequester to add.

setPause(value)

Pause or resume the process.

Parameters:
NameTypeDescription
valueboolean

The new pause state of the process.

start(requesteropt)

Start the process and call the tick function on each interval.

Parameters:
NameTypeAttributesDescription
requesterProcessIntervalTickRequester<optional>

Optional default ProcessIntervalTickRequester.

stop()

Stop the process and clear all tick requesters.