Answer the question
In order to leave comments, you need to log in
What is "opting out of two-way databinding"?
I don't know if this is offtopic for Toaster or not.
Actually, Sergei Protko (Fesor) often uses this phrase, and I have seen it on many forums. What does it mean? Isn't two-way binding the joy of all existing frameworks, a la Angular?
Answer the question
In order to leave comments, you need to log in
there is databinding, an observable relationship between one component and another. For example:
var model = {
title: 'Some Title'
};
function view(container) {
var el = container.querySelector('[data-bind="title"]');
// следим за изменениями
Object.observe(model, (changes) => {
if ('title' === changes.name) {
// обновляем при изменении связанное значение у другого компонента
el.innerHtml = model.title;
}
}, ['update'])
}
A.foo
will always beB.bar
. But this creates such a problem, now both components must take into account that the value of foo and bar can change at any time, and it is not clear who initiated the changes. You can safely enter a state when A changes state, B synchronizes and reacts and changes state again, then A reacts, and maybe some other related components appear. That is, we can quickly and simply grab the recursion. If you have business logic built on this basis, then it will be extremely difficult for you to maintain this system later, debug its hell. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question