nikolalsvk / render_async

render_async lets you include pages asynchronously with AJAX
https://rubygems.org/gems/render_async/
MIT License
1.08k stars 75 forks source link

Call render_async logic every N seconds #77

Closed nikolalsvk closed 5 years ago

nikolalsvk commented 5 years ago

Closes https://github.com/renderedtext/render_async/issues/67

It loads the desired path immediately, and then after specified number of milliseconds passed in as interval to render_async.

You can use interval like this:

<%= render_async comments_path, interval: 1000 %>

It will fetch comments_path every 1 second. Note that the initial render_async container won't be replaced when using interval.

Reason for NOT replacing initial container is that render_async needs to have an ID of the container to render the request response.