If I have a property on an object created by calling Object.defineProperty
on the prototype of its constructor function that returns an array such as:
function Foo() {
this._bar = [];
}
Object.defineProperty(Foo.prototype, 'bar', {
get: function () {
return this._bar;
}
});
How can I capture and override calls to .push()
on the derived bar
property?