Skip to content

Instantly share code, notes, and snippets.

@bulv1ne
Created April 1, 2015 09:01
Show Gist options
  • Save bulv1ne/f0e83d6e6dbe57ca09ee to your computer and use it in GitHub Desktop.
Save bulv1ne/f0e83d6e6dbe57ca09ee to your computer and use it in GitHub Desktop.
.factory('QueuePromise', function($q) {
var lastPromise = $q(function(success, error) {
success();
});
return function(f) {
var lPromise = lastPromise;
lastPromise = $q(function(success, error) {
lPromise['finally'](function() {
f().then(success, error);
});
});
return lastPromise;
};
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment