Jump to navigation

Namespace: schedule

Numbas.schedule

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.

Source:

Members

(static) calls :Array.<function()>

Functions to call

Type:
Source:

(static) completed :Number

Number of tasks completed

Type:
Source:

(static) halt_error :Error

Error which caused the scheduler to halt

Type:
Source:

(static) halted :Boolean

Should the scheduler stop running tasks? Don't use this directly - use Numbas.schedule.halt

Type:
Source:

(static) lifts :Array.<Array.<function()>>

Bits of queue that have been picked up while a task performs sub-tasks

Type:
Source:

(static) total :Number

Total number of tasks ever scheduled

Type:
Source:

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 {task: fn, error: fn}, where error is a callback if an error is caused

that Object

what this should be when the function is called

Source:

(static) drop()

Put the last lifted queue back on the end of the real queue

Source:

(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
Source:
See:

(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

Source:

(static) pop()

Pop the first task off the queue and run it.

If there's an error, the scheduler halts and shows the error.

Source:

Type Definitions

callback

Type:
Properties:
Name Type Description
Promise Promise
resolve function

the promise's resolve function

reject function

the promise's reject function

resolved Boolean

has the promise been resolved?

Source:

task_object

Type:
Properties:
Name Type Description
task function

The function to execute.

error function

A callback, used if an error is raised.

Source: