• function

then can.Deferred.prototype.then

 

Add callbacks to a Deferred.

deferred.then(doneCallback[, failCallback])

Parameters

  1. doneCallback {function()}

    A function called when the Deferred is resolved.

  2. failCallback {function()}Optional

    A function called when the Deferred is rejected.

deferred.then( doneCallback, failCallback ) adds handler(s) to be called when the Deferred object to be called after its resolved.

var def = can.Deferred();
def.then(function(){
    //- Called when the deferred is resolved.
}, function(){
    //- Called when the deferred fails.
})