Last Updated: February 25, 2016
·
2.877K
· stevegreatrex

Create instantly-resolved jQuery.Deferred objects

Quick way to create an instance of jQuery.Deferred that is already resolved with a specific value:

var instantDeferred = $.when("result")

instantDeferred.state(); // => "resolved"

instantDeferred.done(function(data) {
    console.log(data);
};
// => "result"