1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Document fat arrow in class definitions.

This pleasently surprised but also confused me when it worked. Now it's
documented. No example (yet), alas, but better than nothing.

Originally added in/around 07e66dd2.
This commit is contained in:
Jo Liss 2011-11-23 17:04:36 +01:00
parent 03b8222c9e
commit d2c3b79617

View file

@ -780,10 +780,15 @@ Expressions
</p>
<%= code_for('fat_arrow') %>
<p>
If we had used <tt>-></tt> in the callback above, <tt>@customer</tt> would
If we had used <tt>-&gt;</tt> in the callback above, <tt>@customer</tt> would
have referred to the undefined "customer" property of the DOM element,
and trying to call <tt>purchase()</tt> on it would have raised an exception.
</p>
<p>
When used in a class definition, methods declared with the fat arrow will
be automatically bound to each instance of the class when the instance is
constructed.
</p>
<p>
<span id="embedded" class="bookmark"></span>