Closed danielmiladinov closed 8 years ago
+1 on doing all these performance-impacting things in debug mode only
@lijunle See the tests, any mutations to refined cursor values, even when they're scalars, do cause the root cursor's value's mutation to be observed. Object.freeze
still remains a worthy alternative to explore, and I'm also in favor of only performing Object.observe
in debug mode.
@danielmiladinov I am OK with Object.observe
. Seeing from the ES7 supporting table, only Chrome supports it. (Opera is not tested in the table.)
Then, say something like this in README: In debug mode, it will block and throws an exception when mutate cursor object. (Only support Chrome browser).
We went with object.freeze approach - closing this unmerged
@danielmiladinov Is Object.observe deeply observe the object? If yes, maybe great to use Object.observe.
Object.freeze only freeze the first level properties. For deeply freeze, MDN provide a performance-affecting snippet.
Besides, is there a way to do such validation in debug mode only? (Future implementation is OK for this.)