Skip to content

Commit 9ae3324

Browse files
committed
移除对 XMLHttpRequest 的抽象;移动 AV._ajax 的加载到 utils.js
1 parent 1549e3b commit 9ae3324

File tree

7 files changed

+3
-9
lines changed

7 files changed

+3
-9
lines changed

lib/av.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ var AV = module.exports = {};
1212
AV._ = require('underscore');
1313
AV.VERSION = require('./version');
1414
AV.Promise = require('./promise');
15-
AV.XMLHttpRequest = require('./browserify-wrapper/xmlhttprequest').XMLHttpRequest;
1615
AV.localStorage = require('./localstorage');
1716

1817
// 以下模块为了兼容原有代码,使用这种加载方式。
@@ -34,7 +33,5 @@ require('./status')(AV);
3433
require('./search')(AV);
3534
require('./insight')(AV);
3635

37-
AV._ajax = require('./browserify-wrapper/ajax');
38-
3936
// Backward compatibility
4037
AV.AV = AV;

lib/browserify-wrapper/ajax-browser.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
var XMLHttpRequest = require('./xmlhttprequest').XMLHttpRequest;
21
var Promise = require('../promise');
32

43
module.exports = function _ajax(method, url, data, success, error) {

lib/browserify-wrapper/upload-browser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = function upload(file, AV, saveOptions) {
2222
var promise = new AV.Promise();
2323
var handled = false;
2424

25-
var xhr = new AV.XMLHttpRequest();
25+
var xhr = new XMLHttpRequest();
2626

2727
if (xhr.upload) {
2828
xhr.upload.onprogress = saveOptions.onProgress;

lib/browserify-wrapper/xmlhttprequest-browser.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

lib/browserify-wrapper/xmlhttprequest.js

Whitespace-only changes.

lib/utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ module.exports = function(AV) {
246246
return new Date(Date.UTC(year, month, day, hour, minute, second, milli));
247247
};
248248

249+
AV._ajax = require('./browserify-wrapper/ajax');
250+
249251
// A self-propagating extend function.
250252
AV._extend = function(protoProps, classProps) {
251253
var child = inherits(this, protoProps, classProps);

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
"react-native": false,
4343
"./lib/browserify-wrapper/ajax.js": "./lib/browserify-wrapper/ajax-browser.js",
4444
"./lib/browserify-wrapper/upload.js": "./lib/browserify-wrapper/upload-browser.js",
45-
"./lib/browserify-wrapper/xmlhttprequest.js": "./lib/browserify-wrapper/xmlhttprequest-browser.js",
4645
"./lib/browserify-wrapper/localStorage.js": "./lib/browserify-wrapper/localstorage-browser.js",
4746
"./lib/browserify-wrapper/parse-base64.js": "./lib/browserify-wrapper/parse-base64-browser.js"
4847
}

0 commit comments

Comments
 (0)