pomelo组件..
1.pomelo会加载lib/components目录下的组件.并设置为属性..和存储在Pomelo.components中..注意这里其实存储的是对象的构造函数..
function load() { return require('./components/' + name); } Pomelo.components.__defineGetter__(name, load); Pomelo.__defineGetter__(name, load);
2.当app.start的时候..会加载默认组件:master和monitor组件
app.load(pomelo.master, app.get('masterConfig')); //从这里可以看到..可以将配置提前赋值到app中
3.Application.load 加载组件..会把组件存储到app中的load和component中.. 注意这里的组件是组件实例化后的对象了
if(typeof component === 'function') {
component = component(this, opts);
}
......
this.loaded.push(component); if(name) { // components with a name would get by name throught app.components later. this.components[name] = component; }