oe-ajax

2.2.0 • Public • Published

<oe-ajax>

The oe-ajax element exposes network request functionality.

Forked from iron-ajax due to below issue and it adds access token to the header when a request is made.

<oe-ajax
    auto
    url="https://www.googleapis.com/youtube/v3/search"
    params='{"part":"snippet", "q":"polymer", "key": "YOUTUBE_API_KEY", "type": "video"}'
    handle-as="json"
    on-response="handleResponse"
    debounce-duration="300"></oe-ajax>

With auto set to true, the element performs a request whenoeer 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.

<oe-request>

oe-request can be used to perform XMLHttpRequests.

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

/oe-ajax/

    Package Sidebar

    Install

    npm i oe-ajax

    Weekly Downloads

    4

    Version

    2.2.0

    License

    MIT

    Unpacked Size

    146 kB

    Total Files

    16

    Last publish

    Collaborators

    • dipdawiz
    • vamsee147