jquerypoll
v1.0.5
Published
A poller for calling an AJAX endpoint until a user-defined condition is met
Downloads
10
Maintainers
Readme
$.poll
Allows you to poll an AJAX call until your pre-defined condition is met. Ideal for displaying a spinner until an action is complete.
Build
API
/*
url: Points to the GET endpoint from where to poll
interval_in_milliseconds: Interval between calls to the url
terminator_callback: A callback function that returns true to indicate end of polling
*/
$.poll(urlToPoll, intervalInMilliseconds, terminatorCallback)
$.poll('http://my/url', 100, (xhr, status, data) => {
return data.hello === 'world';
})