Created
April 1, 2015 09:01
-
-
Save bulv1ne/f0e83d6e6dbe57ca09ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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