3 ms·
One wouldn't know that intuitively, because what you wrote: longRunning () -> "Yippee!" () -> "Oh noes" ... is not valid CoffeeScript. I'm not
by jashkenas 15y ago
One wouldn't know that intuitively, because what you wrote:
longRunning
() -> "Yippee!"
() -> "Oh noes"
... is not valid CoffeeScript. I'm not sure where you got that from.
Ideally, you'd write it:
longRunning onSuccess, onError
Or, if you really wanted to use two inline functions instead of local variables:
longRunning (-> "Yippee!"), (-> "Oh noes")
- MatthewPhillips 15y agoThanks. A more realistic example would, I suppose, look like this: longRunning (-> ### bunch of stuff happening for success ### ), (-> ### bunch of stuff happening for failures ### )
- jashkenas 15y agoYes, that'll work fine, as will this, if you prefer: longRunning -> # bunch of stuff happening for success , -> # bunch of stuff happening for failures