CodeCatalyst/promise.coffee — pull request #2 by jesstelford (2013-11-01 17:37:15+00:00)
Title: Allow immediate resolution upon Deferred instantiation

Allows simplifying patterns like so:

```coffeescript
cachedValue = null
foo = ->
if cachedValue?
return (new Deferred cachedValue).promise
d = new Deferred
$.get('/some/slow/process').done( (data) ->
cachedValue = data
d.resolve data
)
return d.promise
foo() # Slow running
foo() # Cached value returned
```