Deferred = (require './libs/jsdeferred.js').Deferred
Deferred.define()
func = (s, t)->
def = new Deferred()
console.log "Im works"
setTimeout(()->
console.log s
, t)
return def
next(()->
return func("Hello", 3000)
).next(()->
return func("World", 1000)
)
$ coffee test.coffee
Im works
Hello
Deferred = (require './libs/jsdeferred.js').Deferred
Deferred.define()
func = (s, t)->
def = new Deferred()
console.log "Im works"
setTimeout(()->
console.log s
def.call
, t)
return def
next(()->
return func("Hello", 3000)
).next(()->
return func("World", 1000)
)