Docs > API > kit

The kit global variable contains some miscellaneous methods.
If you create a variable named "kit", it will over-write the existing global variable and you will be unable to access its methods (unless you copy it first), e.g.
backupKit = kit;
kit = "string";
// this still works
backupKit.sleep(1000);
Methods
kit.getLabel(label, language) Retrieve a string of translated text (in a particular language) from a label.
kit.getStackTrace() Fetch the full stacktrace of a JavaScript error. It must be used on the special __exception__ variable, as in the example below:
try {
throw "NewError";
} catch (e) {
st = kit.getStackTrace(__exception__);
out.writeln("Oh no! " + e);
out.writeln("Full stacktrace: " + st);
// keep going
}
kit.quote(string) Wrap a string in quotation marks (') and escape as appropriate, e.g.
string = "I'm writing code";
kit.quote(string);
// => 'I\'m writing code'
kit.sleep(millis) Pause the script for this many milliseconds. Returns the number of milliseconds that the script actually did sleep.
kit.xmlEscape(string) Convert special XML characters into their corresponding entities, e.g. < becomes &lt;
kit.xmlUnescape(string) Convert XML entities into their corresponding characters, e.g. &lt; becomes <

Can't find what you're looking for?

Let us know and we'll see if we can help.