Define a variable on a Backbone View
In the Views of my code, I am used to the following examples:
//for functions
functionName: function(…){…},
//for objects
objectName: function(…){…},
//for returning a function
nameToReturnFunction: function(…){ return {…} },
How would I write the following, not in the render() or init()?
var pathFunction = d3.svg.line()
.x(function (d) {return d.x;})
.y(function (d) {return d.y;})
.interpolate('basis'); // bundle | basis | linear | cardinal are
also options
I have declared the variable in the render or init and then used
this.pathFunction = pathFunction;, but since there are no parameters, how
do I attach this variable function chain to the View as part of itself.
No comments:
Post a Comment