A main design goal of the SDK is to provide a succinct, efficient API for manipulating and querying a Unit Map™. This is achieved through selection objects which provide a chaining API and maintain a collection of the objects they represent. Each set can further be manipulated and filtered using methods such as
has, etc; similar to jQuery and other jQuery-like API's.
For instance, the following code sample will set the fill color to
#f0f for Unit objects with ID's of
map.units().find([1, 2, 3, 4, 5]).color('#f0f');
All queryable values should be strings, however the values are cast internally, so it's safe to pass integer representations.
Updated almost 5 years ago