jsonp_p
Jsonp in Promise and callback mode.
Installing
npm install jsonp_p
Usage
; // Promise mode; // callback mode;
options
url
;
request url
[params]
;
query string defaultencodeURI
[callback]
;
callback name
[timeout]
;
[onSuccess]
;
If callback mode is preferred, then a function can be passed to onSuccess
[onError]
;
Just like onSuccess, available if callback mode is preferred
Callback and Promise
jsonp_p
supports callback mode now.
If a global Promise
is available, jsonp_p
can also run in Promise mode.
If your environment doesn't support Promise
, you can add polyfill.