@Caltor wrote:
With the advent of ES6 we can now use getters as in:
export class col { constructor(left, width = 140) { this.left = left; this.width = width; } get middle() { return this.left + this.width/2; } }
Previously I would have used a computed property in the example above to obtain the
middle
value. Is there any advantage to either approach? Theget
seems ideal to me as I don’t have toimport
anything and remember to identify the key fields I will be watching. Just wondered if there are any disadvantages to this (performance?) compared to traditional Ember computed properties or any gotchas of which I need to be aware.
Posts: 6
Participants: 2