can.List.prototype.always

  • function
 

list.always( alwaysCallback )

Add handlers to be called when the list is either resolved or rejected. This works very similar to jQuery's always.

Parameters

  1. alwaysCallback {function(reasonOrList)}

    A function that is called when the list's promise is resolved or rejected. It will be called with the list if the promise is resolved, or the reason if the promise is rejected.

Returns

{Promise}

The list's promise.

Use

var data = new can.Deferred();
var list = new can.List(data);

list.always(function(l){
  l === list //-> true
});

data.resolved(["a","b"]);