41eba67118c3600627ec476f413a3e8d7e60ea3f763d02092783c9bb063bc87ea1a8d7bf32db3f955ef5491d4b2f439516c90267d0b8a4797b680433185a66 349 B

123456789101112131415161718
  1. /* @flow */
  2. export function runQueue (queue: Array<?NavigationGuard>, fn: Function, cb: Function) {
  3. const step = index => {
  4. if (index >= queue.length) {
  5. cb()
  6. } else {
  7. if (queue[index]) {
  8. fn(queue[index], () => {
  9. step(index + 1)
  10. })
  11. } else {
  12. step(index + 1)
  13. }
  14. }
  15. }
  16. step(0)
  17. }