我是JavaScript的新手,我不太确定在我的应用程序中使用的以下遗留淘汰赛和JS代码:
file1.js:
var FbPicturesObj = { fbPicturesVM: new FbPicturesVM(), initialize: function () { ko.applyBindings(FbPicturesObj.fbPicturesVM, $("#fb-albums")[0]); ko.applyBindings(FbPicturesObj.fbPicturesVM, $("#fb-album-photos")[0]); }, Reset: function Reset() { FbPicturesObj.fbPicturesVM.albums([]); FbPicturesObj.fbPicturesVM.photos([]); } }
file2.js:
function FbPicturesVM() { ...... some code .... }
我的问题是:
每次调用FbPicturesObj.fbPicturesVM
都会在内存中创建fbPicturesVM的新实例吗?
是ko.applyBindings
调用正确写入?(在代码优化方面)
非常感谢.