Answer the question
In order to leave comments, you need to log in
Is there a module to create reactive methods?
We need the following module. The input is an object method and a callback. The method code is analyzed, browsers are hung on the properties used in the method, when any of these properties change, the value of the method is recalculated and the result is passed to the callback.
Example:
class People {
constructor() {
this.firstName = 'noname';
this.lastName = 'Man';
}
name() {
return this.firstName + ' ' + this.lastName;
}
hello() {
return `Hello, ${this.name()}!`;
}
}
const people = new People();
//вешаем обозреватель на hello
pseudo_observable(people, 'hello', (value) => console.log(value));
people.firstName = 'Cool';
//console.log => Hello, Cool Man!
Answer the question
In order to leave comments, you need to log in
There are links to reactive libs with an explanation of the difference: https://habrahabr.ru/post/317360/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question