Creates the promise, invokes callback and resolves the promise.
callback /* invoked before the chain continues. Optional. */
errback /* invoked when previous Promise is rejected( error in the chain). Optional. If present the error is not propagated further and the return value used as result for current chain action. */
string /* used as action result after filling $0, $1, ... from executed in the action chain results. Optional. */
$.sleep(10) .$then( "+$0" ) // +10 .$then( "$0-$1") // +10-10 .$then( ( a, b, c )=>console.log(a,b,c) ); // +10-10, +10, 10
- any non-string or function used as action result
The promises chain shimmed the jQuery and Xml4jQuery methods.
Callback arguments also same as in $then().