d4rklit3 d4rklit3 - 4 months ago 10
Javascript Question

CoffeeScript, pass multiple parameters including an anonymous function

I am not sure how to write this in CS. maybe some1 can help:

FB.getLoginStatus(function (response) {} , {scope : scope})


thanks.

Answer

You would write some CoffeeScript like so...

FB.getLoginStatus(
  (response) -> 
    doSomething()
  {scope: scope})

Which would convert to the JavaScript like so...

FB.getLoginStatus(function(response) {
  return doSomething();
}, {
  scope: scope
});
Comments