This is some kind of question from curiossity.
The question arises:
How does this client framework work, let me explain.
I have been working with javascript for over 5 years. And I don’t understand anything. How do they know when the value of a variable changes (for example, title) ???.
I would do it like this:
function onTitleChange(title) {
let title = "This is some title"
let lastTitle = title;
setInterval(() => {
if(lastTitle !== title) {
onTitleChange(title);
lastTitle = title
}
}, 10);
Is that how they all work? Is this how Vue.js knows when a variable's value changes? If not, what kind of magic do they use to know when a variable's value changes?
source
share