szurubooru/public_html/js/Promise.js
Marcin Kurczewski 2bb20c49fd Removed {mangle: false} requirement to uglify-js
Improves solution to #4 for javasript files by 12K (in current build).
2014-10-18 18:48:21 +02:00

28 lines
463 B
JavaScript

var App = App || {};
App.Promise = function(jQuery) {
function make(callback)
{
var deferred = jQuery.Deferred();
callback(deferred.resolve, deferred.reject);
return deferred.promise();
}
function wait(promise) {
return jQuery.when(promise);
}
function waitAll() {
return jQuery.when.apply(jQuery, arguments);
}
return {
make: make,
wait: wait,
waitAll: waitAll,
};
};
App.DI.registerSingleton('promise', ['jQuery'], App.Promise);