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:
parent
03b8222c9e
commit
d2c3b79617
1 changed files with 6 additions and 1 deletions
|
@ -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>-></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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue