APPSTATE refactoring:

- Make index.html cacheable by being stateless
- Improve compression (base64 doesn't gzip well)
- Remove base64 encoding/decoding step
- Make AppState injectable so it can be unit tested
- Ready to remove the global leakage
This commit is contained in:
Gunther Brunner
2014-08-22 15:04:16 +09:00
parent 743f8becd6
commit e27e17d699
9 changed files with 92 additions and 51 deletions

View File

@@ -0,0 +1,24 @@
module.exports = function AppStateProvider() {
var values = {
config: {
websocketUrl: ''
},
user: {
settings: {}
}
}
/*globals GLOBAL_APPSTATE:false*/
if (GLOBAL_APPSTATE) {
values = angular.extend(values, GLOBAL_APPSTATE)
}
return {
set: function (constants) {
angular.extend(values, constants)
},
$get: function () {
return values
}
}
}