coool
coool

Reputation: 8297

what is the coffeescript equivalent for this

I lost the coffee file..so I am trying to trace back the js file to coffee and I use js2coffee site to do it...but this code is confusing.. I don't remember what I wrote in coffee

  function PersonalEdit() {
    this.changeNR = __bind(this.changeNR, this);
    this.changeDisability = __bind(this.changeDisability, this);
    this.changeMaritalStatus = __bind(this.changeMaritalStatus, this);
    return PersonalEdit.__super__.constructor.apply(this, arguments);
  }

I can trace back the function to a constructor

    constructor: ->
        super

what is about the __bind..I know they are generated for fat arrow.but how can this be in the constructor...

Upvotes: 0

Views: 47

Answers (1)

Leonid Beschastny
Leonid Beschastny

Reputation: 51480

Those bindings were generated from fat arrows => in class methods definition.

So, your class looked something like this:

class PersonalEdit
  constructor: ->
    super

  changeNR: =>
    # ...

  changeDisability: =>
    # ...

  changeMaritalStatus: =>
    # ...

Upvotes: 1

Related Questions