Skip to content

Commit 28b55f5

Browse files
committed
Cleaning
1 parent 9087ae1 commit 28b55f5

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

package/src/ConfigurationProvider.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@ export class ConfigurationProvider<T> {
88
constructor() {
99
this.mergedConfiguration = <T>{};
1010

11-
this.addObject((<any>window).webConfig, true);
12-
this.addObject((<any>window).configuration, true);
11+
this.addConfiguration((<any>window).webConfig, true);
12+
this.addConfiguration((<any>window).configuration, true);
1313
}
1414

1515
public $get($q: angular.IQService) {
1616
return this.mergedConfiguration;
1717
}
1818

19-
public get(): T {
20-
return this.mergedConfiguration;
21-
}
22-
23-
public addObject(obj: any, optional?: boolean) {
19+
public addConfiguration(obj: T, optional?: boolean) {
2420
if (obj) {
2521
this.mergedConfiguration = <T>merge(this.mergedConfiguration, obj);
2622
} else {
@@ -34,7 +30,7 @@ export class ConfigurationProvider<T> {
3430
* Add a default object that will only add params that aren't already specified
3531
* @param obj
3632
*/
37-
public addDefaultObject(obj: any) {
33+
public addDefaultObject(obj: T) {
3834
if (obj) {
3935
this.mergedConfiguration = <T>merge(obj, this.mergedConfiguration);
4036
}

test-app/src/app/index.config.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
'use strict';
22
import {ConfigurationProvider} from "gl-angular-configuration/package/src/ConfigurationProvider";
3-
4-
interface ITestAppConfiguration {
5-
env: string
6-
}
3+
import {ITestAppConfiguration} from "./configuration/ITestAppConfiguration.d.ts";
74

85
export class Config {
96
/** @ngInject */
107
constructor(configurationProvider: ConfigurationProvider<ITestAppConfiguration>) {
118

129
// you can add configuration objects in the configuration function of Angular
13-
configurationProvider.addObject({otherParam: 'test'});
10+
configurationProvider.addConfiguration({otherParam: 'test'});
1411
}
1512
}

0 commit comments

Comments
 (0)