%PojoViz is a tool to analyze the plain objects of a JavaScript object hierarchy by finding all the relationships found between the hierarchy entry point (in most libraries/frameworks a global variable) and the objects/functions linked to it.
Note: this webpage uses Shadow DOM, it’s suggested that you use a browser that supports this technology for a complete experience.
How many times did you find an awesome library/framework and wanted to see how it’s structured just for fun?
window.d3
would be the access point to the library)In short %PojoViz receives as input a collection of JS objects and then:
See development
See an interactive tutorial on how to visualize your stuff
%PojoViz doesn’t analyze the AST of your code (which might be done by Esprima btw), it’s sort of an static analysis tool but it doesn’t analyze your code, it just traverses JS objects
Let’s say that you give %PojoViz the following constructor Point
// reachable
function Point(x, y) {
// unreachable
this.foo = function () {
};
// unreachable
this.bar = {};
}
// reachable
Point.prototype.publicMethod = function () {
}
To make the method foo
and the object bar
reachable you’d need to
create an instance of Point
e.g. instance = new Point(1, 2)
%PojoViz doesn’t know about how to instantiate stuff,
however if you feed %Pojoviz Point
AND instance
you’re good to go :)
A huge description of this and other uses of %PojoViz can be found in the development section
Sure you can, in fact the Node Globals section makes a query to a node server hosted on heroku and the analysis is done on runtime! The output of %PojoViz is an “stringifiable” collection which is rendered by pojoviz-renderer, you can even analyze code of other programming languages with an adapter that outputs a similar collection and render it with pojoviz-renderer!
Special thanks once again to @mrdoob the author of three.js and to @mbostock author of d3.