jsonp
A sane JSONP implementation.
Last updated 14 years ago .
Original npm · Tarball · package.json
$ npm install jsonp 
SYNC missed versions from official npm registry.

jsonp

A simple JSONP implementation.

saucelabs

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 fetch
  • opts (Object), optional
    • param (String) name of the query string parameter to specify the callback (defaults to callback)
    • timeout (Number) how long after a timeout error is emitted. 0 to disable (defaults to 60000)
    • 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 to prefix + 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

Current Tags

  • 0.2.1                                ...           latest (10 years ago)

7 Versions

  • 0.2.1                                ...           10 years ago
  • 0.2.0                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
  • 0.0.4                                ...           12 years ago
  • 0.0.3                                ...           14 years ago
  • 0.0.2                                ...           14 years ago
  • 0.0.1                                ...           14 years ago
Maintainers (1)
Downloads
Total 14
Today 0
This Week 0
This Month 14
Last Day 0
Last Week 13
Last Month 0
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

© 2010 - cnpmjs.org x YWFE | Home | YWFE