Class scheduler
Extends
component.
scheduler
Defined in: scheduler.js.
Constructor Attributes | Constructor Name and Description |
---|---|
A component that allows for automatic running
of logic at certain intervals.
|
Field Attributes | Field Name and Description |
---|---|
Returns all registered tasks by name.
|
- Fields borrowed from class component:
- host, info, isDrawing, isStepping, onAttach, onDraw, onStep, tag
Method Attributes | Method Name and Description |
---|---|
endTask(name)
Halts the task with the given name.
|
|
getTaskInterval(name)
Returns the millisecond rate of the given task name.
|
|
pause()
Pauses the timer from the pause state.
|
|
resume()
Resumes the scheduler from the pause state.
|
|
startTask(name, interval, function)
Begins a new task.
|
- Methods borrowed from class component:
- canHandleEvent, draw, emitEvent, getKnownEvents, installEvent, installHandler, installHook, step, uninstallEvent, uninstallHandler, uninstallHook
Class Detail
scheduler()
A component that allows for automatic running
of logic at certain intervals.
Field Detail
{names}
tasks
Returns all registered tasks by name.
Method Detail
endTask(name)
Halts the task with the given name.
If there is no task with the given name, no action is taken.
- Parameters:
- {String} name
- Name of the interval to end.
{Number}
getTaskInterval(name)
Returns the millisecond rate of the given task name.
- Parameters:
- {String} name
- Returns:
- {Number}
pause()
Pauses the timer from the pause state.
resume()
Resumes the scheduler from the pause state.
startTask(name, interval, function)
Begins a new task. A task will run
once per every announced millisecond interval.
The resolution is only as good as the number of times the
host's step() is called. In an Engine context, this is usually
locked to the sandboxe's max FPS.
- Parameters:
- {String} name
- Name of the task.
- {Number} interval
- Interval in milliseconds.
- {Function} function
- Function to run at the given interval