Tools for EventScripter

System function: requireOnce()

Description

requireOnce(string file)

Requires a javascript file only once.

Example

requireOnce(JD_HOME + "/eventscripter/my-required-script-file.js");

Sourcecode

JD_HOME/eventscripter/system/requireOnce.js
/*jslint browser */
/*global getPath, require */
function requireOnce(file) {
    var path = getPath(file).getAbsolutePath();
    if (requireOnce.list.indexOf(path) === -1) {
        requireOnce.list.push(path);
        require(file);
    }
}
requireOnce.list = [];