Skip to content

Commit d3cbc1d

Browse files
committed
# Conflicts: # package/dist/ConfigurationProvider.js # package/dist/src/ConfigurationProvider.d.ts
2 parents d9b3261 + a1e937b commit d3cbc1d

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

package/dist/ConfigurationProvider.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484
this.mergedConfiguration = merge(obj, this.mergedConfiguration);
8585
}
8686
};
87+
/**
88+
* Get the configuration object at config.
89+
* It can be useful to configure other providers with the loaded configuration
90+
* @returns {T}
91+
*/
8792
ConfigurationProvider.prototype.getConfiguration = function () {
8893
return this.mergedConfiguration;
8994
};
@@ -95,8 +100,8 @@
95100
xobj.overrideMimeType("application/json");
96101
xobj.open('GET', 'configuration.json', true); // Replace 'my_data' with the path to your file
97102
xobj.onreadystatechange = function () {
98-
if (xobj.readyState == 4) {
99-
if (xobj.status == 200) {
103+
if (xobj.readyState === 4) {
104+
if ((xobj.status === 200 || xobj.status === 0) && xobj.responseText) {
100105
window.configuration = JSON.parse(xobj.responseText);
101106
}
102107
callback();

package/dist/src/ConfigurationProvider.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ export declare class ConfigurationProvider<T> {
88
* @param obj
99
*/
1010
addDefaultConfiguration(obj: T): void;
11+
/**
12+
* Get the configuration object at config.
13+
* It can be useful to configure other providers with the loaded configuration
14+
* @returns {T}
15+
*/
1116
getConfiguration(): T;
1217
}
1318
export declare function loadConfigurationJSON(callback: any): void;

package/src/ConfigurationProvider.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ export function loadConfigurationJSON(callback) {
5252
xobj.overrideMimeType("application/json");
5353
xobj.open('GET', 'configuration.json', true); // Replace 'my_data' with the path to your file
5454
xobj.onreadystatechange = function () {
55-
if (xobj.readyState == 4) {
56-
if (xobj.status == 200) {
55+
if (xobj.readyState === 4) {
56+
if ((xobj.status === 200 || xobj.status === 0) && xobj.responseText) {
5757
(<any>window).configuration = JSON.parse(xobj.responseText);
5858
}
5959
callback();

0 commit comments

Comments
 (0)