我想在构造时防止同步器属性,因为我可以将persistedObject 发送到X 类。
function X(persistanceObject) {
var self = this;
self.xid = -1;
self.syncer = ko.computed(function () {
// if object construction in progress then return
// persist properties....
}, self);
self.y = ko.observable(43);
if (typeof persistanceObject !== 'undefined') {
ko.mapping.fromJS(persistanceObject, {}, self.y);
}
}