title: How to implement browser based Queue backed by indexeddb or localstorage?
body: <p>I'm looking for a Browser based queue data structure, backed by persistent storage (localStorage or indexeddb) that can be used in JS. </p>
  
  <p>My use case is for an offline app where it should use the queue to communicate with a server once it comes back online.</p>
  
  <p>Ie, something like rails delayed_job or resque, but for the browser.</p>
  
  <p>It would support an API like this:</p>
  
  <pre><code>Queue.Enqueue(() =&gt; { // do something  })
  </code></pre>
  
  <p>The queue would dequeu execute the function (in the background like a webworker or something hopefully) and poll for new entries periodically. </p>
  
  <p>How would I implement this?</p>