-
Notifications
You must be signed in to change notification settings - Fork 0
Chris Willoughby edited this page Oct 23, 2015
·
5 revisions
Trove.Map is a class used to hold metadata on a map. It is a subclass of Trove.Work.
It can be constructed with an init argument to request the data immediately:
var my_map = new Trove.Map({
init: 189341370,
done: function(map) {
console.log(JSON.stringify(map, null, '\t'));
}
});or you can use the get() method to request the data at some later time:
var my_map = new Trove.Map({
done: function(map) {
console.log(JSON.stringify(map, null, '\t'));
}
});
my_map.get({id: 189341370});If you want to re-request data, perhaps with more included information, just call get() again with the includes and/or reclevel options (the id parameter is optional if specified earlier):
my_map.get({
id: 189341370,
reclevel: Trove.RECLEVEL.FULL
});You can also specify these on construction:
function map_done (map) {
console.log(JSON.stringify(map, null, '\t'));
}
var my_map = new Trove.Map({
init: 189341370,
reclevel: Trove.RECLEVEL.FULL,
includes: [Trove.INCLUDE.TAGS, Trove.INCLUDE.COMMENTS],
done: map_done
});The done and fail callbacks can be set via the options on construction or on the get() method. If set with the get() method after being set on construction, the new callbacks will be used from there on.