Poyozo API
From Poyozo
This API is designed to provide you with a simple way to access and visualize your data in whatever ways you like. Your canvas is the HTML5 canvas element and you can use any of the tools in the latest version of javascript.
Get a subset of your data using: 'getPeople()', 'getPlaces()', 'getNotes()', 'getCalendarEvents()' and 'getWebpages()
printEntity(getPeople()[0]); // prints an entity from your database
Events also exist such as the time that you view a particular website. Currently, there are only website viewed events and locations events. Print events using the 'printEvent' function. All events have 'start', 'end', 'type' and 'entity' property
printEvent(getWWWEvents()[0]); printEvent(getLocationEvents()[0]);
Raw Data Access
We cannot make an API for all conceivable types of data that you could have in your database. For a more raw access to your data, use these tools:
getTypes(); // returns all types of data printTypes(); // prints all types of data
If a type's superclass is 'schemas.entity' then you can use getEntities({type:"schemas.Person"}) to see all entities of that type. If it it's superclass is 'schemas.event' use getEvents("www-viewed") instead.
getEntities({foo:"bar"}); // gets all entities with 'foo' property with a value of 'bar' getEvents("www-viewed"); // gets all website viewed events
Event Listeners
You can add event listeners for when an 'event' occurs. Events include: 'www-viewed' and 'location'. For example:
addNewEventListener("www-viewed", function(evt) { printEvent(evt); });
Or you can add an event listener for when an entity changes
var p0 = getPeople()[0]; addEntityChangedListener(p0, function(whom) { printEntity(whom); });
Examples
In all Vislets, the HTML5 canvas element is called 'World' and the 'ctx' reference for the 2d drawing context has already been created. The canvas width and height are CANVASWIDTH and CANVASHEIGHT. Please use these instead of creating your own so that your Vislet will take full advantage of any size display.
More examples are coming soon.
have fun!
