Created
December 2, 2014 09:05
-
-
Save jareware/efa910c6283fd6be8598 to your computer and use it in GitHub Desktop.
A simple PromiseQueue w/ ES6
This file contains 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
function PromiseQueue() { | |
var tail = Promise.resolve(); | |
return { | |
enqueueOperation(op) { | |
return tail = tail.then(op, op); | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment