Closed MartinMuzatko closed 8 years ago
@MartinMuzatko add() {}
is non-standard. Both tag.add = add;
and this.add = function() {}.bind(this)
are both at least valid JavaScript.
I think the rest comes down to preference. We have a preference to "put tag properties and methods on top", which is in turn based on Angular Style Guide > "Bindable members on top". In short it ensures you get a "table of contents of a tag's properties and methods" and that's why it works well for us.
Thanks for explaining. I have to admit it is confusing when mixing event handlers and "private" methods
I agree that the so called magic es6 methods
add() {}
was confusing first, but it is riot-specific and usuallyBut I'd avoid writing up the additional
tag.add = add
and rather use the original syntax or writethis.add = function() {}.bind(this)
instead of this:Discussion?