1 line
1.9 KiB
JSON
1 line
1.9 KiB
JSON
{"name":"deferred.always","type":"method","title":"deferred.always()","deprecated":null,"removed":null,"desc":" Add handlers to be called when the Deferred object is either resolved or rejected. ","categories":["deferred-object","version/1.6"],"entries":[{"return":"Deferred","signatures":{"added":"1.6","argument":[{"desc":"\n A function, or array of functions, that is called when the Deferred is resolved or rejected.\n ","name":"alwaysCallbacks","type":"Function"},{"desc":"\n Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected.\n ","name":"alwaysCallbacks","type":"Function","optional":"true"}]},"examples":{"desc":"Since the <ahref=\"/jQuery.get/\"><code>jQuery.get()</code></a> method returns a <code>jqXHR</code> object, which is derived from a Deferred object, we can attach a callback for both success and error using the <code>deferred.always()</code> method.","code":"\n$.get( \"test.php\" ).always(function() {\n alert( \"$.get completed with success or error callback arguments\" );\n});\n"},"longdesc":"\n <p>The argument can be either a single function or an array of functions. When the Deferred is resolved or rejected, the <code>alwaysCallbacks</code> are called. Since <code>deferred.always()</code> returns the Deferred object, other methods of the Deferred object can be chained to this one, including additional <code>.always()</code> methods. When the Deferred is resolved or rejected, callbacks are executed in the order they were added, using the arguments provided to the <a href=\"/deferred.resolve/\"><code>resolve</code></a>, <a href=\"/deferred.reject/\"><code>reject</code></a>, <a href=\"/deferred.resolveWith/\"><code>resolveWith</code></a> or <a href=\"/deferred.rejectWith/\"><code>rejectWith</code></a> method calls. For more information, see the documentation for <a href=\"/category/deferred-object/\">Deferred object</a>.</p>\n "}]} |