-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError function has no method 'handler' #183
Comments
Update : Apparently it's due to an interraction with cubicweb. CubicWeb change the mecanisms on arrays. It adds some other objects and it's that that make sigma fail. Sigma try to use one of these objects as a handler |
Hi, The issue comes from the fact that sigma.js iterate the arrays with the 'in' operator. If a third-party library inject functions in the Array prototype (which is our case), its name is iterated as well as the indexes of the array, leading to this function being mistaken for a handler by sigma.js. The solution is to change the way sigma.js iterate over the arrays. More specifically, we should replace: for (j in SOMEARRAY) {
// ...
} with for (j = 0; j !== SOMEARRAY.length; j += 1) {
// ...
} Another approach would be to still use the 'in' operator but to have a more defensive loop content that checks if the 'j' variable is indeed and integer : I highly doubt it is the way to go though. I am working on a patch that implement the solution I propose, hoping it will be accepted. Cheers, Christophe |
'for in' also iterate over additionnal attributes set on the Array prototype, leading to unexpected behaviors. To make sigma.js more defensive against third-party libraries modifying the Array prototype, a more classic way of iterating is required. This patch solve issue jacomyal#183.
Thanks to @cdevienne's last pull request #185, this issue should now be fixed. |
Great, thanks a lot guys |
Hi all.
I'm new on sigma. I successfully loaded it and generated my edges and nodes. My graph displays well and I even succeded to use the forceAtlas.
But whenever I 'mouseover' the graph, try to click or to drag I have this error :
TypeError: Object function () {
cw.log(msg);
return newfunc.apply(this, arguments);
} has no method 'handler'
I can't properly zoom or see labels by going over a node.
Did I forgot something simple ?
Thanks in advance
The text was updated successfully, but these errors were encountered: