As O.o is already been deprecated what are the other options we have to observe the properties of a Javascript Object.
Asked
Active
Viewed 6,994 times
1
-
Check http://stackoverflow.com/questions/36258502/why-has-object-observe-been-deprecated – Jordi Nebot Apr 27 '17 at 10:24
-
getter and setter – Thomas Apr 27 '17 at 10:24
-
Quote from MDN: `However, this API has been deprecated and removed from browsers. You can use the more general Proxy object instead.` – Shilly Apr 27 '17 at 10:24
-
@Shilly: Proxy is not yet supported in IE. – Ashutosh Apr 27 '17 at 11:05
2 Answers
1
As stated in the mdn documentation : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
The Object.observe() method was used for asynchronously observing the changes to an object. It provided a stream of changes in the order in which they occur. However, this API has been deprecated and removed from browsers. You can use the more general Proxy object instead.
![](../../users/profiles/1814888.webp)
Magus
- 13,609
- 2
- 31
- 47
0
you can achieve this with getters and setters and alternatively, in a browser with support for Proxies, you can write a more generic solution. Check here
![](../../users/profiles/-1.webp)
Community
- 1
- 1
![](../../users/profiles/7894640.webp)
sujeet kumar srivastava
- 186
- 5
-
The issue is that you have to plug into the object chain. There is no way to observe changes in a "readymade" object that is parsed from JSON for example.. – Julian F. Weinert Oct 12 '20 at 19:24