mirror of
https://github.com/BorysLevytskyi/BitwiseCmd.git
synced 2026-01-06 03:52:39 +01:00
Introduced AppShall
This commit is contained in:
36
core/appShell.js
Normal file
36
core/appShell.js
Normal 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;
|
||||
})();
|
||||
Reference in New Issue
Block a user