Having some problem extracting inner functions in javascript. Consider the following function:
this.zoomListener = d3.zoom()
.on("zoom", (function(){
new_xScale = d3.event.transform.rescaleX(this.xScale)
new_yScale = d3.event.transform.rescaleY(this.yScale)
}).bind(this));
To be a little more flexible i wanted to change the structur of the inner function like this:
this.zoomListener = d3.zoom()
.on("zoom", zoomFunction);
function zoomFunction(){
new_xScale = d3.event.transform.rescaleX(this.xScale)
new_yScale = d3.event.transform.rescaleY(this.yScale)
}
How can i bind the function now?