[refactor] bump version

This commit is contained in:
Ziqiang Li 2017-08-07 20:34:16 +08:00
parent cc175aca05
commit 10ae6427ec
2 changed files with 14 additions and 14 deletions

View file

@ -9,15 +9,15 @@ let count = 0;
* *
* Options: * Options:
* - prefix {String} callback prefix (defaults to `__jp`) * - prefix {String} callback prefix (defaults to `__jp`)
* - jsonp {String} qs jsonpeter (defaults to `callback`) * - callback {String} (defaults to `callback`)
* - timeout {Number} how long after the request until a timeout error * - timeout {Number} how long after the request until a timeout error
* is emitted (defaults to `15000`) * is emitted (defaults to `15000`)
*/ */
let jsonp = function( url, options ) { let jsonp = function( url, options ) {
options = options || {}; options = options || {};
let prefix = options.prefix || '__jp'; let prefix = options.prefix || '__jp';
let jsonp = options.jsonp || 'callback'; let callback = options.callback || 'callback';
let params = options.params || {}; let params = options.data || {};
let timeout = options.timeout ? options.timeout : 15000; let timeout = options.timeout ? options.timeout : 15000;
let target = document.getElementsByTagName( 'script' )[ 0 ] || document.head; let target = document.getElementsByTagName( 'script' )[ 0 ] || document.head;
let script; let script;
@ -46,7 +46,7 @@ let jsonp = function( url, options ) {
cleanup(); cleanup();
resolve( data ); resolve( data );
}; };
params[ jsonp ] = id; params[ callback ] = id;
for ( let key in params ) { for ( let key in params ) {
url += (~url.indexOf( '?' ) ? '&' : '?') + key + '=' + encodeURIComponent( params[ key ] ); url += (~url.indexOf( '?' ) ? '&' : '?') + key + '=' + encodeURIComponent( params[ key ] );
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "simple-jsonp-promise", "name": "simple-jsonp-promise",
"version": "1.0.0", "version": "1.0.1",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {