Jump to navigation

Namespace: Numbas

Numbas

Members

(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) store

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

Source:

Methods

(static) addExtension(name, deps, callback)

A wrapper round Numbas.queueScript to register extensions easily.

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()

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

Source:

(static) debug(msg, noStackopt)

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

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: