jsonp

A simple JSONP implementation

Github星跟踪图

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

主要指标

概览
名称与所有者webmodules/jsonp
主编程语言JavaScript
编程语言JavaScript (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2012-07-04 08:16:38
推送于2024-04-08 22:08:00
最后一次提交2016-11-01 01:21:53
发布数7
最新版本名称0.2.1 (发布于 2016-11-01 01:21:53)
第一版名称0.0.1 (发布于 )
用户参与
星数1.9k
关注者数51
派生数330
提交数56
已启用问题?
问题数37
打开的问题数26
拉请求数12
打开的拉请求数4
关闭的拉请求数10
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?