what meaning of defaults: function($super) , domain: function($super) in javascript?. following code taken openstack-horizon. using high level of javascript concept know basic of javascript.
rickshaw.graph.renderer.staticaxes = rickshaw.class.create(rickshaw.graph.renderer.line, { name: 'staticaxes', defaults: function($super) { alert("13 => repeated many time. rickshaw.graph.renderer.staticaxes"); return rickshaw.extend($super(), { xmin: undefined, xmax: undefined, ymin: undefined, ymax: undefined }); }, domain: function($super) { //alert("hj"); var ret = $super(); var xmin, xmax; // if y axis wants have static range, not based on data if (this.ymin !== undefined && this.ymax !== undefined) { ret.y = [this.ymin, this.ymax]; } // if x axis wants have static range, not based on data if (this.xmin !== undefined && this.xmax !== undefined) { xmin = d3.time.format.utc('%y-%m-%dt%h:%m:%s').parse(this.xmin); xmin = xmin.gettime() / 1000; xmax = d3.time.format.utc('%y-%m-%dt%h:%m:%s').parse(this.xmax); xmax = xmax.gettime() / 1000; ret.x = [xmin, xmax]; } return ret; } });
consider code.
var objectliteral = { variable: "i'm string", fun: function(param) { console.log("i'm function."); console.log("here's param: ", param); } } console.log(objectliteral); objectliteral.fun(); fun , variable fields of object literal.
function() syntax used declare function, assigned fun.
Comments
Post a Comment