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
exception on registering events to the renderer #134
Comments
and patching the code like this seems to work: on: function(eventName, callback) {
// publicEvents.addEventListener(eventName, callback);
publicEvents.on(eventName, callback);
return this;
},
off: function(eventName, callback) {
// publicEvents.removeEventListener(eventName, callback);
publicEvents.off(eventName, callback);
return this;
} |
in addition to that fix, we also need to change the following line on renderer.js:
it should be
https://github.com/anvaka/VivaGraphJS/blob/master/src/View/renderer.js#L9 after this fix, publicEvents object has only three methods |
…vaka#134 There was a bug with setting the eventify variable on `renderer.js`. Instead of ngraph.events, the variable is set from the `ngraph.graph` After this fix, publicEvents object has on and off methods to register events. event registration methods for the renderer erroneously uses `publicEvents.addEventListener` and `publicEvents.removeEventListener` method. changed the method name to `on` and `off`, respectively.
Thanks for reporting this and fixing! Do you want to send the pull request? |
fixed wrong js loading for eventify and publicEvents event methods #134
Thank you once again for the PR. This is merged and released as |
@ahmetkizilay Could you please explain how eventify worked in your example ? I tried to registered In your example I tried to see what is passed to the function:
it prints the scale value but cannot see where does it take that property from renderer. My intention is to explore if I can handle events better in SVG, and use only one listener to the renderer / graph container. |
I am trying to register an event callback with
renderer.on('scale', fn)
but vivagraph (0.7.8) throws an exception.the error is that inside the
on
methodpublicEvents.addEventListener
is not a defined function. I checked with the inspector and publicEvents does not have that function indeed. In fact, it looks like there is a wrong assignment here for publicEvents, because it seems to contain methods that belong to the graph module.see the js fiddle here: http://jsfiddle.net/sym6b55k/
The text was updated successfully, but these errors were encountered: