IdManager

Provides methods for declaring and checking IDs.

Remarks

The IdManager works in conjunction with the Jitsu Cruncher to provide a consistent way to reference symbolic strings in JavaScript.

Methods

checkChecks that the specified id name is valid, throwing an exception if it is not.
declareDeclares a list of IDs that will be used in the script and that should be crunched.

IdManager check static method

Checks that the specified id name is valid, throwing an exception if it is not.

JavaScript

IdManager.check(id)

Example

To check that ID_foo was declard, use:

IdManager.check("foo");

IdManager declare static method

Declares a list of IDs that will be used in the script and that should be crunched.

JavaScript

IdManager.declare()

Example

Here's the typical way to declare IDs:

IdManager.declare("ID_example", "ID_anotherExample");

This is equivalent to writing:

var ID_example="example", ID_anotherExample="anotherExample";

except that, when the application is crunched, the cruncher generates shorter names for the IDs.