Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

20 lines (14 sloc) 0.509 kb
class InvoiceForm
constructor: (@customer) ->
# Value of "this" might not be the InvoiceForm class
calculateTotal: =>
# do some fancy calculation
total = 10
alert "#{this.customer} your total is #{total}"
$ ->
invoice = new InvoiceForm("Acme Corporation")
$('#btnCalculate').click invoice.calculateTotal
# If you look at the JavaScript code generated, the
# code to make sure "this" is what you expect is
# more complicated than a simple _this.
Jump to Line
Something went wrong with that request. Please try again.