title: How to use promises with recursive fetch?
body: <p>I am using fetch to retrieve a tree, one layer at a time. How can I trigger an action after all branches have been fetched? The tree has multiple branches and I don't know the depth in advance.</p>
  
  <p>Pseudo-code:</p>
  
  <pre><code>until Children is empty fetchChildren()
  
  after all children are retrieved doSomething()
  </code></pre>
  
  <p>I found some answers, but they only deal with chained then(), not trees.</p>
  
  <p>[edit] Although not mandatory, I am hoping that the solution can run in IE11. I am already using promise and fetch polyfills.</p>