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:
Fires:
  • Numbas.Part#event:finaliseLoad

(static) createPartFromXML

Create a question part based on an XML definition.

Source:
Fires:
  • Numbas.Part#event:finaliseLoad

(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) 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) addExtension(name, deps, callback)

A wrapper round Numbas.queueScript to register extensions easily. The extension is not run immediately - call Numbas.activateExtension to run the extension.

Parameters:
Name Type Description
name string

Unique name of the extension.

deps Array.<string>

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

callback function

Code to set up the extension. It's given the object Numbas.extensions.<name> as a parameter, which contains a Numbas.jme.Scope object.

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) getStandaloneFileURL(extension, path) → {string}

Get the URL of a standalone file from an extension.

Parameters:
Name Type Description
extension string

The name of the extension.

path string

The path to the script, relative to the extension's standalone_scripts folder.

Returns:
Type Description
string
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.

Fires:
  • Numbas.signals#event:exam_ready
  • Numbas.signals#event:Numbas_initialised
Source:

(static) loadStandaloneScript(extension, path)

Load a standalone script from an extension. Inserts a