Put in local (vm) and global (settings) flags which switch between observe and tryObserve for bindings.
Maybe need a recursive makeObservable function too
Or maybe something like
wo.viewModel("xxx")
.observeModel("prop1")
.observeModel("prop2.prop3")
.observeModel("prop4*.prop5") // * is an array
-- or --
wo.viewModel("xxx")
.autoObserve(true);
// which begets
xxx.onTemplateChange(function (template) {
this.disposeOfPreviousObservablePaths();
enumerateArr(template.getAllViewModelAndHtmlSetters(), function (setter) {
if (setter.isFromModel)
wo.makeObservablePath(setter);
});
});
view.disposeOfPreviousObservablePaths = function () {
enumerate(paths, function () {
disposeOf(path);
if (!path.object.hasAnyMoreSubscriptions()) {
busybody.unMakeObservable(path.object);
}
});
}
// this will need changes to busybody:
// busybody.unMakeObservable()
// busybody.hasObservers()
// caveat: this code will need to be fired when something changes on the model
// caveat: this code will need to be fired before bindings are made
Put in local (vm) and global (settings) flags which switch between observe and tryObserve for bindings. Maybe need a recursive makeObservable function too Or maybe something like
-- or --