mirror of
https://github.com/BorysLevytskyi/BitwiseCmd.git
synced 2025-12-23 21:22:48 +01:00
41 lines
832 B
JavaScript
41 lines
832 B
JavaScript
(function (should, Container) {
|
|
|
|
var app = {
|
|
views: {},
|
|
models: {},
|
|
debugMode: false
|
|
};
|
|
|
|
var commandHandlers = {};
|
|
var runObservers = [];
|
|
|
|
app.di = new Container();
|
|
|
|
app.component = function(name, inst) {
|
|
if(arguments.length == 1) {
|
|
return this.di.resolve(name);
|
|
}
|
|
|
|
this.di.register(name, inst);
|
|
};
|
|
|
|
app.get = function(name) {
|
|
return this.di.resolve(name);
|
|
};
|
|
|
|
app.run = function(observer) {
|
|
runObservers.push(observer);
|
|
};
|
|
|
|
app.bootstrap = function(rootViewElement) {
|
|
this.rootViewElement = rootViewElement;
|
|
invokeRunObservers();
|
|
};
|
|
|
|
function invokeRunObservers() {
|
|
runObservers.forEach(function(o){ o(); });
|
|
}
|
|
|
|
window.app = app;
|
|
|
|
})(window.should, window.Container); |