-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
139 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
import { XHRFactory } from "./XHRFactory"; | ||
import { Promise, PromiseConstructor, ConfigurePromise } from "./Promise"; | ||
import { IXHROptions, IXHRApi } from "./Interfaces"; | ||
import { FetchOptions } from 'fetch'; | ||
import { XHRDefault } from './XHRDefault'; | ||
|
||
export class ConfigurationApi { | ||
|
||
static ConfigureXHR(xhrApi: IXHRApi) { | ||
XHRFactory.xhrHelper = xhrApi; | ||
} | ||
|
||
static SetXHROptions(fetchOptions: FetchOptions) { | ||
XHRDefault.defaultOptions = fetchOptions; | ||
} | ||
|
||
static ConfigurePromise(promise: PromiseConstructor) { | ||
ConfigurePromise(promise); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
import { Promise } from "./Promise"; | ||
import { IXHROptions, IXHRApi } from "./Interfaces"; | ||
import { XHRDefaults } from "./XHRDefaults" | ||
import { XHRDefault } from "./XHRDefault" | ||
|
||
export class XHRFactory { | ||
|
||
static xhrHelper: IXHRApi; | ||
static get XHRApi() { | ||
if (typeof this.xhrHelper === 'undefined' || this.xhrHelper === null) { | ||
this.xhrHelper = new XHRDefaults(); | ||
this.xhrHelper = new XHRDefault(); | ||
} | ||
return this.xhrHelper; | ||
} | ||
|
||
public static newXHRApi() { | ||
return new XHRDefaults(); | ||
console.warn("depricated, import and use \"new XHRDefault(options?)\" instead") | ||
return new XHRDefault(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters