Namespace: wrappers

curious.CuriousClient.wrappers

Convenience functions for interfacing with a variety of common HTTP/ajax client libraries. NOTE: None of these client libraries are required by this module—the wrappers are here simply to help CuriousCient interact with code that uses those libraries. NOTE: jQuery.post does not need a wrapper--it, and any other functions that work like it and resolve to the same kind of data structure can be passed directly as the request parameter.
Source:

Methods

(static) CuriousClient.wrappers.angular(angularHttpServiceOrPostFunctionnullable, optionsnullable) → {function}

Convenience function to make it easier to interact with AngularJS $http.post responses (AngularJS is not required by this module at all.)
Parameters:
Name Type Attributes Description
angularHttpServiceOrPostFunction Object <nullable>
Either the Angular $http service object, or $http.post--defaults to using whatever $http resolves to.
options Object <nullable>
Additional options to send to the requesting function
Source:
Returns:
A function that meets the requirements to make requests in the curious client: takes the url and arguments, makes a POST request and returns a promise that resolves directly to the returned query response (unwrapped)
Type
function
Example
var client = new CuriousClient(CURIOUS_URL, CuriousClient.wrappers.angular() ...)
var client = new CuriousClient(CURIOUS_URL, CuriousClient.wrappers.angular($http) ...)

(static) CuriousClient.wrappers.axios(axiosModuleOrFunctionnullable, optionsnullable) → {function}

Convenience function to make it easier to interact with axios responses (axios is not required by this module at all.)
Parameters:
Name Type Attributes Description
axiosModuleOrFunction Object <nullable>
Either the axios module itself, or axios.post--defaults to using whatever axios resolves to
options Object <nullable>
Additional options to send to the requesting function
Source:
Returns:
A function that meets the requirements to make requests in the curious client: takes the url and arguments, makes an axios post request, and returns a promise that resolves directly to the returned query response (unwrapped).
Type
function
Example
var client = new CuriousClient(CURIOUS_URL, CuriousClient.wrappers.axios() ...)
var client = new CuriousClient(CURIOUS_URL, CuriousClient.wrappers.axios(axios) ...)

(static) CuriousClient.wrappers.ironAjax(ironAjaxElementnon-null, optionsnullable) → {function}

Convenience function to make it easier to interact with Polymer's <iron-ajax> element.
Parameters:
Name Type Attributes Description
ironAjaxElement PolymerElement The iron-ajax element being used to make the request
options Object <nullable>
Additional options to send to the requesting function
Source:
Returns:
A function that meets the requirements to make requests in the curious client: takes the url and arguments, makes a POST request with ironAjaxElement, and returns a promise that resolves directly to the returned query response (unwrapped)
Type
function
Example
var client = new CuriousClient(CURIOUS_URL, CuriousClient.wrappers.ironAjax(this.$.xhr) ...)