Comparing version 1.0.5-beta0.1 to 1.0.5-beta0.2
@@ -29,3 +29,3 @@ { | ||
"license": "MIT", | ||
"version": "1.0.5-beta0.1", | ||
"version": "1.0.5-beta0.2", | ||
"engines": { | ||
@@ -32,0 +32,0 @@ "node": ">= 0.6" |
@@ -52,3 +52,3 @@ /** | ||
static useParas(...paras: Array<string|object>): JNetwork{ | ||
let instance = new this(); | ||
let instance = this.defaultInstance(); | ||
instance.extraParas = paras; | ||
@@ -59,3 +59,3 @@ return instance; | ||
static useHeaders(...headers: Array<string|object>): JNetwork{ | ||
let instance = new this(); | ||
let instance = this.defaultInstance(); | ||
instance.extraHeaders = headers; | ||
@@ -75,4 +75,4 @@ return instance; | ||
static instance(): JNetwork { | ||
return new this(); | ||
static instance(config: INetworkConfig = DEFAULT_CONFIG): JNetwork { | ||
return new JNetwork(config); | ||
} | ||
@@ -82,3 +82,3 @@ | ||
if (!this._instance) { | ||
this._instance = new this(); | ||
this._instance = new JNetwork(); | ||
} | ||
@@ -221,3 +221,3 @@ return this._instance; | ||
static freedomPOST(baseUrl: string, url?: string, parameters?: object, headers?: object, otherObject?: object): JPromise<AxiosResponse|JNetworkError> { | ||
return this.instance().freedomPOST(baseUrl, url, parameters, headers, otherObject) | ||
return this.defaultInstance().freedomPOST(baseUrl, url, parameters, headers, otherObject) | ||
} | ||
@@ -235,29 +235,5 @@ | ||
static freedomGET(baseUrl: string, url?: string, parameters?: object, headers?: object, otherObject?: object): JPromise<AxiosResponse|JNetworkError> { | ||
return this.instance().freedomGET(baseUrl, url, parameters, headers, otherObject) | ||
return this.defaultInstance().freedomGET(baseUrl, url, parameters, headers, otherObject) | ||
} | ||
/** | ||
* post请求 | ||
* @param {string} url 相对地址 | ||
* @param {object} parameters 地址参数 | ||
* @param {object} headers 头参数 | ||
* @param {object} otherObject 其他参数 | ||
* @returns {Promise} 异步请求块 | ||
*/ | ||
static POST(url: string, parameters?: object, headers?: object, otherObject?: object): JPromise<AxiosResponse|JNetworkError> { | ||
return this.instance().POST(url, parameters, headers, otherObject) | ||
} | ||
/** | ||
* get请求 | ||
* @param {string} url 相对地址 | ||
* @param {object} parameters 地址参数 | ||
* @param {object} headers 头参数 | ||
* @param {object} otherObject 其他参数 | ||
* @returns {Promise} 异步请求块 | ||
*/ | ||
static GET(url: string, parameters?: object, headers?: object, otherObject?: object): JPromise<AxiosResponse|JNetworkError> { | ||
return this.instance().GET(url, parameters, headers, otherObject) | ||
} | ||
getCarryData(): object{ | ||
@@ -264,0 +240,0 @@ let carryData: object = null; |
Sorry, the diff of this file is too big to display
222326
4573