Skip to content

Commit ae0e02a

Browse files
committed
fixed jshint warn
1 parent 3b2d2c4 commit ae0e02a

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

src/qiniu.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*global plupload */
22
/*global ActiveXObject */
3+
/*exported Qiniu */
34

45
function QiniuJsSDK() {
56

@@ -207,7 +208,9 @@ function QiniuJsSDK() {
207208
// Logic borrowed from http://json.org/json2.js
208209
if (/^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, "@").replace(/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) {
209210

210-
return (new Function("return " + data))();
211+
return (function() {
212+
return data;
213+
})();
211214
}
212215
}
213216
}
@@ -232,8 +235,8 @@ function QiniuJsSDK() {
232235

233236
var option = {};
234237

235-
var Error_Handler = op.init && op.init.Error;
236-
var FileUploaded_Handler = op.init && op.init.FileUploaded;
238+
var _Error_Handler = op.init && op.init.Error;
239+
var _FileUploaded_Handler = op.init && op.init.FileUploaded;
237240

238241
op.init.Error = function() {};
239242
op.init.FileUploaded = function() {};
@@ -406,7 +409,7 @@ function QiniuJsSDK() {
406409

407410
});
408411

409-
uploader.bind('Error', (function(Error_Handler) {
412+
uploader.bind('Error', (function(_Error_Handler) {
410413
return function(up, err) {
411414
var errTip = '';
412415
var file = err.file;
@@ -448,7 +451,7 @@ function QiniuJsSDK() {
448451
errorObj = that.parseJSON(errorObj.error);
449452
errorText = errorObj.error || 'file exists';
450453
} catch (e) {
451-
console.log(e);
454+
// console.log(e);
452455
}
453456
break;
454457
case 631:
@@ -480,15 +483,15 @@ function QiniuJsSDK() {
480483
errTip = err.message + err.details;
481484
break;
482485
}
483-
if (Error_Handler) {
484-
Error_Handler(up, err, errTip);
486+
if (_Error_Handler) {
487+
_Error_Handler(up, err, errTip);
485488
}
486489
}
487490
up.refresh(); // Reposition Flash/Silverlight
488491
};
489-
})(Error_Handler));
492+
})(_Error_Handler));
490493

491-
uploader.bind('FileUploaded', (function(FileUploaded_Handler) {
494+
uploader.bind('FileUploaded', (function(_FileUploaded_Handler) {
492495
return function(up, file, info) {
493496
var res = that.parseJSON(info.response);
494497
ctx = ctx ? ctx : res.ctx;
@@ -526,9 +529,10 @@ function QiniuJsSDK() {
526529
if (ajax.status === 200) {
527530
var info = ajax.responseText;
528531

529-
if (FileUploaded_Handler) {
530-
FileUploaded_Handler(up, file, info);
532+
if (_FileUploaded_Handler) {
533+
_FileUploaded_Handler(up, file, info);
531534
}
535+
532536
} else {
533537
uploader.trigger('Error', {
534538
status: ajax.status,
@@ -540,13 +544,13 @@ function QiniuJsSDK() {
540544
}
541545
};
542546
} else {
543-
if (FileUploaded_Handler) {
544-
FileUploaded_Handler(up, file, info.response);
547+
if (_FileUploaded_Handler) {
548+
_FileUploaded_Handler(up, file, info.response);
545549
}
546550
}
547551

548552
};
549-
})(FileUploaded_Handler));
553+
})(_FileUploaded_Handler));
550554

551555
return uploader;
552556
};

0 commit comments

Comments
 (0)