qwertyzw qwertyzw - 1 year ago 110
CoffeeScript Question

Coffeescript's Q.defer() then's call back

I've seen

defereed.then (arg) =>
function body


deferred.then (
(arg) =>
function body

Can someone explain the difference?

This is from https://github.com/gwomacks/php-debug/blob/master/lib/engines/dbgp/dbgp-instance.coffee

Answer Source

There is no difference. Parenthesis are optional in Coffeescript:

You don't need to use parentheses to invoke a function if you're passing arguments. The implicit call wraps forward to the end of the line or block expression.

console.log sys.inspect object → console.log(sys.inspect(object));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download