ES6 Promise - how to test if resolved?
<p>I have an ES6 promise.  I would like to use the promise to serialize API requests.  There are interactive requests and background requests.  </p>

<pre><code>var apiPromise = Promise.resolve();

...
// Interactive requests
router.get('/apiRequest', (req,res) =&gt; {
  apiPromise.then(doSomeStuff)
  .then((results) =&gt; {
     res.send(results)
  })

...
// Background requests
setInterval(() =&gt; {
  if (apiPromise is resolved) {
    apiPromise.then(doSomeStuff)
  }
}, 1000*60)
</code></pre>

<p>I'd like to setInterval a function to .then() a queued request, only if the promise has been resolved.  If it's not resolved, just wait to check at the next interval.</p>

<p>What's the best way to do that?</p>

<p><strong>Update</strong>: Bluebird.js offers synchronous inspection: <a href="http://bluebirdjs.com/docs/api/isfulfilled.html" rel="nofollow">http://bluebirdjs.com/docs/api/isfulfilled.html</a></p>