qiniu-web-uploader
Advanced tools
@@ -135,14 +135,24 @@ 'use strict'; | ||
var err = void 0; | ||
xhr.addEventListener('load', function (e) { | ||
var res = JSON.parse(xhr.responseText); | ||
cb(err, res); | ||
}); | ||
xhr.addEventListener('error', function (e) { | ||
if (_this4._errorTry) { | ||
_this4._errorTry--; | ||
_this4._execPost(url, data, contentType, cb); | ||
} else { | ||
cb(e, {}); | ||
} | ||
}); | ||
if (xhr.addEventListener) { | ||
xhr.addEventListener('load', function (e) { | ||
var res = JSON.parse(xhr.responseText); | ||
cb(err, res); | ||
}); | ||
xhr.addEventListener('error', function (e) { | ||
if (_this4._errorTry) { | ||
_this4._errorTry--; | ||
_this4._execPost(url, data, contentType, cb); | ||
} else { | ||
cb(e, {}); | ||
} | ||
}); | ||
} else { | ||
xhr.onreadystatechange = function () { | ||
if (xhr.readyState == 4 && xhr.status == 200) { | ||
var res = JSON.parse(xhr.responseText); | ||
cb(err, res); | ||
} | ||
}; | ||
xhr.onerror = function (e) {}; | ||
} | ||
xhr.open('POST', url, true); | ||
@@ -149,0 +159,0 @@ xhr.setRequestHeader('Content-Type', contentType); |
{ | ||
"name": "qiniu-web-uploader", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "七牛上传模块", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -130,14 +130,24 @@ import { EventEmitter } from 'events'; | ||
let err; | ||
xhr.addEventListener('load', e => { | ||
let res = JSON.parse(xhr.responseText); | ||
cb(err, res); | ||
}); | ||
xhr.addEventListener('error', e => { | ||
if(this._errorTry) { | ||
this._errorTry --; | ||
this._execPost(url, data, contentType, cb); | ||
} else { | ||
cb(e, {}); | ||
if(xhr.addEventListener) { | ||
xhr.addEventListener('load', e => { | ||
let res = JSON.parse(xhr.responseText); | ||
cb(err, res); | ||
}); | ||
xhr.addEventListener('error', e => { | ||
if(this._errorTry) { | ||
this._errorTry --; | ||
this._execPost(url, data, contentType, cb); | ||
} else { | ||
cb(e, {}); | ||
} | ||
}); | ||
} else { | ||
xhr.onreadystatechange = () => { | ||
if(xhr.readyState==4 && xhr.status==200){ | ||
let res = JSON.parse(xhr.responseText); | ||
cb(err, res); | ||
} | ||
} | ||
}); | ||
xhr.onerror = e => {}; | ||
} | ||
xhr.open('POST', url, true); | ||
@@ -144,0 +154,0 @@ xhr.setRequestHeader('Content-Type', contentType); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
355047
0.17%6000
0.33%0
-100%