Object.defineProperty 可以给对象添加一下属性,并且带一些设置,比较实用的就是 Getter/Setter.
Object.defineProperty
Getter/Setter
那么请问,如果添加的属性是一个对象或者数组, Getter/Setter 要怎么弄呢?好像并不能检测到对象(数组)内变化
Proxy?
The Proxy object is used to define custom behavior for fundamental operations (e.g. property lookup, assignment, enumeration, function invocation, etc).
CNode 社区为国内最专业的 Node.js 开源技术社区,致力于 Node.js 的技术研究。
Proxy?