I have the following function which I'm trying to implement into Photoshop (uses Javascript ES3 for scripting). How could I write this to be ES3 compatible?
function VParabola(s){
this.cEvent = null;
this.parent = null;
this._left = null;
this._right = null;
this.site = s;
this.isLeaf = (this.site != null);
}
VParabola.prototype = {
get left(){
return this._left;
},
get right(){
return this._right;
},
set left(p){
this._left = p;
p.parent = this;
},
set right(p){
this._right = p;
p.parent = this;
}
};
You can make use of
Object.defineProperty
in your constructor function like