Closed
Description
Hi Reviewer,
For the following code at the link http://learn.jquery.com/code-organization/deferreds/examples/,
it is not very clear how defer.resolve and defer.reject work in the function passed to the $.Deferred() method.
Thank you for reading the issue.
var cachedScriptPromises = {};
$.cachedGetScript = function( url, callback ) {
if ( !cachedScriptPromises[ url ] ) {
cachedScriptPromises[ url ] = $.Deferred(function( defer ) {
$.getScript( url ).then( defer.resolve, defer.reject );
}).promise();
}
return cachedScriptPromises[ url ].done( callback );
};
Metadata
Metadata
Assignees
Labels
No labels