Confirmed users
201
edits
(init) |
|||
| Line 39: | Line 39: | ||
<code>prop = prop() => {}; // Illegal; syntax error.</code> | <code>prop = prop() => {}; // Illegal; syntax error.</code> | ||
==== Caveats ==== | |||
You should avoid to use the same name between the reference and the function. For example: | |||
<code>var tsEnd = (function tsEnd(evt) { | |||
this.element.removeEventListener('trasitionend', tsEnd) | |||
}).bind(this)</code> | |||
This would be failed (not remove the handler) because the statement inside the function, would use the named function as 'tsEnd',not the reference assign to the one generated by the 'bind' function. We can fix this with: | |||
<code>var tsEnd = (function _tsEnd(evt) { | |||
this.element.removeEventListener('trasitionend', tsEnd) | |||
}).bind(this)</code> | |||
Thus, the 'tsEnd' would be the reference, wherever in the function or out of it. | |||