
So I have been messing around with the api and I needed a function to determine is a specific status was set on token. Here is what I came up with but it seems sort of clunky...am I missing some documentation or something on helper methods to do this? Seems like lots of people might want to do this? I saw "libTokenMarkers" but that seems to deal with token_markers which appears to the full list allowed? I am also sure that this code is not full proof yet but I thought I would ask before I spent to much time in it function isTokenStatusSet(selected,status) {
var statusSet = "";
var statusName;
var isStatusSet;
if(selected && selected.length === 1) {
var selected_id = selected[0]._id;
var token = getObj('graphic',selected_id);
if(token) {
statusSet = token.get("statusmarkers").split(",");
for (index = 0; index < statusSet.length; index++) {
statusName = statusSet[index].split("::");
if (statusName[0] == status){
isStatusSet=true;
}
}
}
}
return isStatusSet;
}