CourseLab CourseLab 3.5. User's Guide Previous topic Next topic

Adding custom JavaScript code

CourseLab runtime allows to include custom JavaScript functions and objects. Each module folder contains special module.js file, which is intended to contain custom functions. This file is always included in published course package.

This file already contains two empty functions, which are called at the start of module and on module unload. These functions could not be deleted, but you can edit these functions.

// InitModule
function InitModule()
{
}

// ShutdownModule
function ShutdownModule()
{
}

IMPORTANT! To avoid cross-naming of variables and objects please try do not use global variables. It is the good practice to use custom prefixes or container object for your variables, functions and objects.