-
Notifications
You must be signed in to change notification settings - Fork 1
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
4 changed files
with
42 additions
and
20 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# configurationLoader | ||
|
||
configurationLoader.js loads configurations from a json file and then merges them with existing confiugrations using a flag (overwriteInlineConfigs) to decide which parameters should be overwritten. By default this flag is false, that is inline configurations take precedence over those set in json file. The loader returns a promise object which once resolved will give access to configuration object. This object has also getter and setter methods which should be used to get and set configuration parameters. | ||
|
||
**Usage** | ||
```javascript | ||
configurationLoader({ | ||
json: 'url.to.configuration.json', | ||
data: inline.configuration, | ||
overwriteInlineConfigs: [optional boolean parameter] | ||
}).then(function(data) { | ||
window.myProject.configuration = data; | ||
// It's now safe to run scripts depending on configuration parameters | ||
}); | ||
|
||
var test = myProject.configuration.get('nameOfProperty'); | ||
``` |
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "configurationLoader", | ||
"version": "1.0.0", | ||
"description": "configurationLoader.js loads configurations from a json file and then merges them with existing confiugrations", | ||
"main": "configurationLoader.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/frontend-framework/configuration.git" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/frontend-framework/configuration/issues" | ||
}, | ||
"homepage": "https://github.com/frontend-framework/configuration#readme" | ||
} |