resolveWith

  • function
can.Deferred.prototype.resolveWith  

Resolve a Deferred in a particular context.

deferred.resolveWith(context[, arguments])

Parameters

  1. context {Object}

    Context passed to the doneCallbacks as the this object.

  2. arguments {Array}Optional

    Array of arguments that are passed to the doneCallbacks.

deferred.resolveWith(context, arguments) resolves a Deferred and calls the doneCallbacks with the given arguments.

var def = can.Deferred();
def.done(function(success) {
    this.logSuccess(success); //-> "Can rocks!"
});

var context = {
    logSuccess: function(sucess) {
        console.log(sucess);
    }
};
def.resolveWith(context, ["Can rocks!"]);