我有一段 javascript 代码,我想为其添加命名空间。在此代码中,在函数之外发生了赋值操作。有人可以告诉我如何将它放在命名空间中吗?代码如下。
var mynameSpace={
canvasPanel:{},
stage:{},
someShape:{},
drawLineGraph:function(dataList,color,baseY)
{
//Create a shape
this.dataList=dataList;
this.index=0;
this.currentDay=1;
},
myNameSpace.drawLineGraph.prototype = new createjs.Shape(); //Getting the problem here
myNameSpace.drawLineGraph.prototype.constructor = drawLineGraph; //Getting the problem here**
,
drawLegend:function(){
}
};