有人可以向我解释下面的JavaScript设计模式示例以及它试图完成什么?JavaScript设计模式
var Knockback = { };
Knockback.Observables = (function() {
function Observables(model, mappings_info, view_model) {
this.model = model;
this.mappings_info = mappings_info;
this.view_model = view_model;
//logic in here
}
Observables.prototype.destroy = function() {
//logic in here
this.view_model = null;
this.mappings_info = null;
return this.model = null;
};
return Observables;
})();
Knockback.observables = function(model, mappings_info, view_model, options) {
return new Knockback.Observables(model, mappings_info, view_model, options);
};
你可能会喜欢:HTTP:尽管我无法说出你在这里看到的内容。 – Treffynnon 2012-02-25 12:51:23