Schedule functions to be called. The scheduler can put tiny timeouts in between function calls so the browser doesn't become unresponsive. It also updates the loading bar.
Members
(static) completed :number
Number of tasks completed.
Type:
(static) halt_error :Error
Error which caused the scheduler to halt.
Type:
(static) halted :boolean
Should the scheduler stop running tasks?
Don't use this directly - use Numbas.schedule.halt
.
Type:
(static) lifts :Array.<Array.<function()>>
Bits of queue that have been picked up while a task performs sub-tasks.
Type:
(static) total :number
Total number of tasks ever scheduled.
Type:
Methods
(static) add(fn, that)
Add a task to the queue.
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | Numbas.schedule.task_object | The function to run, or a dictionary |
that |
object | What |
(static) drop()
Put the last lifted queue back on the end of the real queue.
(static) halt(error)
Prevent the scheduler from running any more tasks, and save the error message which caused this.
Parameters:
Name | Type | Description |
---|---|---|
error |
Error |
(static) lift()
Pick up the current queue and put stuff in front. Called before running a task, so it can queue things which must be done before the rest of the queue is called.
(static) pop()
Pop the first task off the queue and run it.
If there's an error, the scheduler halts and shows the error.
(static) reset()
Reset the scheduler: remove all callbacks and signal boxes.
(static) unhalt()
Allow the scheduler to run tasks again. Unhalts all signalboxes too.
Type Definitions
callback
Type:
Properties:
Name | Type | Description |
---|---|---|
Promise |
Promise | |
resolve |
function | The promise's |
reject |
function | The promise's |
resolved |
boolean | Has the promise been resolved? |