jsonp
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-
prefix
(String
)prefix of jsonp callback function name -
name
(String
) you can custom the jsonp callback function name -
params
(String
) name of the query string parameter to specify the callback -
timeout
(Number
) a time limit in milliseconds for the call (default: 60*1000) -
data
(Object
) Other query strings, note that the key with the same name as callback will be ignored
-
-
callback
(Function
)the callback of request, first params is error info, and the second is response data
License
MIT