What's the easiest way to track changes to an object or variable?
-
There is a global variable in which the object is located. Changes are made to the object from time to time. Can you please tell me what is the easiest way to track the fact that an object has changed? Are there any analogs for addEventListener () that could be applied to variables?
Initially, I thought it would be banal to check the variable head-on in a loop through setInterval () , but it seems to me that there should be more efficient solutions, I would not want to reinvent the wheel.JavaScript Connor Gilbert, Aug 15, 2019 -
I won't be smart, I haven't done it myself, although I've been programming for a long time.
You need thisAnonymous -
You can via ProxyAnonymous
-
You need to connect either a global storage such as redax, mobix, etc. or write your own, if you need your own bike.
Look towards reactive programmingAdeline Sanders
3 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!