1.1.2 • Published 7 years ago

jsonp-fallback v1.1.2

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

jsonp-fallback

build status

Meant for use across the browser and node, this simple module will use jsonp if instantiated in a browser and axios if in node. In both cases a promise will be returned.

jsonp-fallback~exports(url, data, params) ⇒ Promise

Execute a GET request using JSONP if in a browser environment.

Kind: inner method of jsonp-fallback
Returns: Promise - Contains the data or error if one was encountered

ParamTypeDescription
urlStringA resource that can be accessed using JSONP
dataObjectParameters to be encoded for the querystring
paramsObjectA parameters object that will be passed through to JSONP if it is used. Note: this module defaults the JSONP timeout value to 15 seconds instead of 60 if it is not specified.

Example

const jsonpFallback = require("jsonp-fallback")

jsonpFallback("https://www.omdbapi.com/", {"i": "tt3397884"})
  .then(data => {
    console.log(data)
  })
  .catch(console.error)
1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

8 years ago

1.0.0

8 years ago