Search code examples
syntaxcoffeescriptsemantics

What's this Coffescript use of then?


In Trevor Burnham's book on Coffeescript (p81) he has

newcard.save().then =>
    ...

Which is not part of a conditional or a switch statement. Is then just a joining word for the syntax or does it have a semantic purpose?


Solution

  • Of course ... It calls the newcard.save().then function - thanks @rightfold - which is in the Angular.js promises api. Not immediately obvious out of context of that api which BTW is nicely explained here.