Package Exports
- jsonp
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jsonp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
jsonp
A simple JSONP implementation.
Installation
Install for node.js or browserify using npm
:
$ npm install jsonp
Install for component(1) using component
:
$ component install LearnBoost/jsonp
Install for browser using bower
:
$ bower install jsonp
API
jsonp(url, opts, fn)
url
(String
) url to fetchopts
(Object
), optionalparam
(String
) name of the query string parameter to specify the callback (defaults tocallback
)timeout
(Number
) how long after a timeout error is emitted.0
to disable (defaults to60000
)prefix
(String
) prefix for the global callback functions that handle jsonp responses (defaults to__jp
)name
(String
) name of the global callback functions that handle jsonp responses (defaults toprefix
+ incremented counter)
fn
callback
The callback is called with err, data
parameters.
If it times out, the err
will be an Error
object whose message
is
Timeout
.
Returns a function that, when called, will cancel the in-progress jsonp request
(fn
won't be called).
License
MIT