Introduced AppShall

This commit is contained in:
Borys Levytskyi
2015-04-04 16:10:17 +03:00
parent a3ca46174b
commit 17fc0bad97
13 changed files with 80 additions and 75 deletions

36
core/appShell.js Normal file
View File

@@ -0,0 +1,36 @@
(function() {
function AppShell(diContainer) {
this.models = {};
this.di = diContainer;
this.runList = [];
this.compositionList = [];
}
AppShell.prototype.get = function(name) {
return this.di.resolve(name);
};
AppShell.prototype.set = function(name, def) {
this.di.register(name, def);
};
AppShell.prototype.run = function(func) {
this.runList.push(func);
};
AppShell.prototype.compose = function (func) {
this.compositionList.push(func);
};
AppShell.prototype.initialize = function () {
callInvocationList(this.compositionList);
callInvocationList(this.runList);
};
function callInvocationList(functions) {
functions.forEach(function(o){ o(); });
}
window.AppShell = AppShell;
})();