iron-ajax-autorenewal

Fork of iron-ajax with the possibility to automatic reload the data defined by an interval


Keywords
web-components, polymer, ajax, autorenewal, autorenew, auto
License
Other
Install
bower install iron-ajax-autorenewal

Documentation

This is a fork of https://github.com/PolymerElements/iron-ajax with the ability to set a interval in wich the data gets reloaded automatically.

<iron-ajax
    auto
    renewal-interval="10000"
    url="http://gdata.youtube.com/feeds/api/videos/"
    params='{"alt":"json", "q":"chrome"}'
    handle-as="json"
    on-response="handleResponse"
    debounce-duration="300"></iron-ajax>

auto needs to be set for auto renewal.

renewal-interval (milliseconds) needs to be higher than 10 000

<iron-ajax>

The iron-ajax element exposes network request functionality.

<iron-ajax
    auto
    url="http://gdata.youtube.com/feeds/api/videos/"
    params='{"alt":"json", "q":"chrome"}'
    handle-as="json"
    on-response="handleResponse"
    debounce-duration="300"></iron-ajax>

With auto set to true, the element performs a request whenever its url, params or body properties are changed. Automatically generated requests will be debounced in the case that multiple attributes are changed sequentially.

Note: The params attribute must be double quoted JSON.

You can trigger a request explicitly by calling generateRequest on the element.

<iron-request>

iron-request can be used to perform XMLHttpRequests.

<iron-request id="xhr"></iron-request>
...
this.$.xhr.send({url: url, params: params});