Querying
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 find
, where
, 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 1
, 2
, 3
, 4
, or 5
.
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 over 6 years ago
What’s Next
You can learn more about selection objects in the following API Reference section.