var f = function (OpenHandleJson) {
var h = new OpenHandle(OpenHandleJson);
var hv = h.getHandleValues();
for (var i = 0; i < hv.length; i++) {
var v = new HandleValue(hv[i]);
if (v.hasType('URL')) {
print(v.getData());
}
else if (v.hasType('HS_ADMIN')) {
var a = new AdminRecord(v.getData());
print(a.getAdminPermissionString())
}
}
}
| "And that, gentlemen, is how we do that." - Apollo 13 |
Following on from my earlier Client Handle Demo post, this entry is just to mention the availability of a port of (part of) the Handle client library (in Java) to JavaScript: openhandle-0.1.1.js which is being maintained on the OpenHandle site. The JavaScript module contains methods for three classes: OpenHandle, HandleValue and AdminRecord.
What does all that mean? It means that Handles and their constituent values and value fields can be accessed directly within any Web browser (using an OpenHandle service) which allows a dynamic Handle client to be generated and presented within a user context. No plugins required. The port mirrors the class methods in the standard Java client library for Handle.
As a demo of this JavaScript module in action, see this Inspector app for a card index view of Handle (and by implication DOI) records.