Jump to navigation

Numbas API documentation

This is the JavaScript API documentation for Numbas.

Numbas is an open-source system for creating online exams which run entirely in the browser, developed by Newcastle University's School of Mathematics, Statistics and Physics.

More general documentation for Numbas is at docs.numbas.org.uk.

This documentation is intended to help Numbas developers, authors of Numbas extensions, or question authors using some of the more advanced features which involve writing JavaScript.

Files

runtime/scripts/controls.js

Wrappers for the various navigation actions the user can do.

The assumption is that these should only be called in response to some event the user triggers, by clicking or whatever.

Provides Numbas.controls

Source:

runtime/scripts/csv.js

Functions related to the download and interpretation of student results, and interaction with the results page, usually for outside-LTI contexts.

Source:

runtime/scripts/download.js

Functions related to creating files to download and encrypting them.

Source:

runtime/scripts/evaluate-settings.js

runtime/scripts/exam.js

Defines the Numbas.Exam object.

Source:

runtime/scripts/jme-builtins.js

Sets up JME built-in functions.

Provides Numbas.jme

Source:

runtime/scripts/jme-calculus.js

Code to do with differentiation and integration

Provides Numbas.jme.calculus

Source:

runtime/scripts/jme-display.js

Stuff to do with displaying JME expressions - convert to TeX, simplify, or convert syntax trees back to JME

Provides Numbas.jme.display

Source:

runtime/scripts/jme-rules.js

Code to do with JME pattern-matching rules.

Provides Numbas.jme.rules

Source:

runtime/scripts/jme-variables.js

Stuff to do with making new functions from JME or JavaScript code, generating question variables, and substituting variables into maths or the DOM.

Provides Numbas.jme.variables

Source:

runtime/scripts/jme.js

Sets up the JME compiler and evaluator.

Provides Numbas.jme

Source:

runtime/scripts/json.js

Stuff to do with loading from JSON objects. Provides Numbas.json.

Source:

runtime/scripts/math.js

Mathematical functions, providing stuff that the built-in Math object doesn't, as well as vector and matrix math operations.

Provides Numbas.math, Numbas.vectormath and Numbas.matrixmath

Source:

runtime/scripts/numbas.js

Contains code to load in the other script files, and initialise the exam.

Creates the global Numbas object, inside which everything else is stored, so as not to conflict with anything else that might be running in the page.

Source:

runtime/scripts/parts/custom_part_type.js

runtime/scripts/parts/extension.js

The Numbas.parts. object

Source:

runtime/scripts/parts/gapfill.js

runtime/scripts/parts/information.js

The Numbas.parts. object

Source:

runtime/scripts/parts/jme.js

runtime/scripts/parts/matrixentry.js

runtime/scripts/parts/multipleresponse.js

runtime/scripts/parts/numberentry.js

runtime/scripts/parts/patternmatch.js

runtime/scripts/question.js

runtime/scripts/schedule.js

runtime/scripts/scorm-storage.js

Provides a storage API Numbas.storage.SCORMStorage which interfaces with SCORM

Source:

runtime/scripts/start-exam.js

runtime/scripts/timing.js

A few functions to do with time and date, and also performance timing. Provides Numbas.timing.

Source:

runtime/scripts/util.js

Convenience functions, extensions to javascript built-ins, etc. Provides Numbas.util. Includes es5-shim.js

Source:

runtime/scripts/xml.js

Stuff to do with loading XML, and getting data out of XML. Provides Numbas.xml.

Source:

themes/default/files/scripts/display.js