A Pause/Play UI

This demo shows how to set up a list that is appended to periodically and that can be paused and resumed

Note that the "server side" implementation is mocked out using mockjax, so you can see the entire implementation. Click the "Source Code" tab to see the code.

Explanation

  • A div polls the /poll url every two seconds by using the ic-prepend-from and ic-poll attributes, and prepends the results into an inner div using the ic-target attribute.
  • Two inner divs post to the server using the ic-post-to attribute and update their respective parent div. The server either starts or stops polling by using the X-IC-ResumePolling or X-IC-CancelPolling response headers, respectively.

Demo