Tuesday, 10 September 2013

JavaScript code explanation (events + canvas) [sigma.js]

JavaScript code explanation (events + canvas) [sigma.js]

Here is some code that I have from sigma.js:
function f(event)
{
sigInst.iterNodes(function(n){
node = n;
},[event.content[0]]);
alert();
}
sigInst.bind('click',f).bind('outnodes',f).draw();
I don't understand this:
from where function f gets the event? no one passes it.
line },[event.content[0]]);
Can I add events to canvas elements? sigma.js draws a canvas and then (I
don't understand how) there is an event listeners on click and outnodes.
How does this happens?
Thanks

No comments:

Post a Comment