Skip to content

Latest commit

 

History

History
62 lines (39 loc) · 1.75 KB

readme.md

File metadata and controls

62 lines (39 loc) · 1.75 KB

jsonp

GitHub Size Version Files Bundle Download Issues Start

中文

A simple JSONP implementation base on typescript build by rollup。

install

install by npm

npm install jsonp --save

🎉 feature

  • light

    dist file just less than 1kb after gzip

  • type safe

    write by typescript and provide all type declare

  • sourceMap

    sourcemap inside, you can debug your fetch step by step

  • openSource

    get the source code for free and build your own dist

API

jsonp(url, option, callback)
  • url (String) fetch url
  • option (Object) optional
    • prefixString)prefix of jsonp callback function name
    • nameString) you can custom the jsonp callback function name
    • params (String) name of the query string parameter to specify the callback
    • timeoutNumber) a time limit in milliseconds for the call (default: 60*1000)
    • dataObject) Other query strings, note that the key with the same name as callback will be ignored
  • callbackFunction)the callback of request, first params is error info, and the second is response data

License

MIT