Jump to navigation

Namespace: Numbas

Numbas

Members

(static) createExamFromJSON

Create a Numbas.Exam object from a JSON definition.

Source:

(static) createExamFromXML

Create a Numbas.Exam object from an XML definition.

Source:

(static) createPart

Create a new question part.

Source:
See:

(static) createPartFromJSON

Create a question part based on an XML definition.

Source:

(static) createPartFromXML

Create a question part based on an XML definition.

Source:

(static) createQuestionFromJSON

Create a Numbas.Question object from a JSON object.

Source:

(static) createQuestionFromXML

Create a Numbas.Question object from an XML definition.

Source:

(static) custom_part_types :object

Definitions of custom part types.

Type:
Source:

(static) exam :Numbas.Exam

The current exam.

Type:
Source:

(static) extensions

Extensions should add objects to this so they can be accessed

Source:

(static) loadScript

Ask to load a javascript file. Unless noreq is set, the file's code must be wrapped in a call to Numbas.queueScript with its filename as the first parameter.

Source:

(static) locale :object

Resources to do with localisation: preferred_locale is the code of the locale to use, and resources is a dictionary of localisations.

Type:
Source:

(static) marking_scripts :object.<Numbas.marking.MarkingScript>

Marking scripts for the built-in part types.

Type:
Source:

(static) partConstructors

Associate part type names with their object constructors. These constructors are called by Numbas.createPart - they should be finalised constructors with all the generic part methods implemented. Most often, you do this by extending Numbas.parts.Part.

Source:

(static) raw_marking_scripts :object.<string>

Definitions of marking scripts for the built-in part types.

Type:
Source:

(static) rawxml :object.<string>

Raw XML of the exam definition.

Type:
Source:

(static) signals :Numbas.schedule.SignalBox

Signals produced by the Numbas runtime.

Type:
Source:

(static) store

The active storage object (Numbas.storage) to be used by the exam

Source:

Methods

(static) activateExtension(name)

Run the extension with the given name. The extension must have already been registered with Numbas.addExtension.

Parameters:
Name Type Description
name string
Source:

(static) checkAllScriptsLoaded() → {Array.<object>}

Check all required scripts have executed - the theme should call this once the document has loaded.

Returns:
Type Description
Array.<object>

A list of files which have not loaded.

Source:

(static) debug(msg, noStackopt, error)

A function for displaying debug info in the console. It will try to give a reference back to the line that called it, if it can.

Parameters:
Name Type Attributes Default Description
msg string

Text to display.

noStack boolean <optional>
false

Don't show the stack trace.

error Error
Source:

(static) init()

Initialise the exam:

  • Connect to the LMS, which might have saved student answers
  • Load the exam XML and the XSL templates
  • create and initialise the exam object
  • display the frontpage

This function is called when all the other scripts have been loaded and executed. It uses the scheduling system to make sure the browser isn't locked up when the exam is being initialised.

Source:

(static) queueScript(file, deps, callback)

Queue up a file's code to be executed. Each script should be wrapped in this function.

Parameters:
Name Type Description
file string

Name of the script.

deps Array.<string>

A list of other scripts which need to be run before this one can be run.

callback function

A function wrapping up this file's code.

Source:

(static) showError(e)

Display an error in a nice alert box. Also sends the error to the console via Numbas.debug.

Parameters:
Name Type Description
e Error
Source:

(static) tryInit()

Called when all files have been requested, will try to execute all queued code if all script files have been loaded.

Source: