Skip to content

Instantly share code, notes, and snippets.

@Ky6uk
Last active August 29, 2015 14:19
Show Gist options
  • Save Ky6uk/0b227e5421e4c3d00839 to your computer and use it in GitHub Desktop.
Save Ky6uk/0b227e5421e4c3d00839 to your computer and use it in GitHub Desktop.
Plz wait em all
var whenAll = function (...deferreds) {
var _promises = [];
deferreds.forEach(function (deferred) {
var _deferred = new $.Deferred;
deferred.always(function () {
_deferred.resolve();
});
_promises.push(_deferred.promise());
});
return $.when(..._promises);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment