0. setup
- all components loaded into registry
- all mixins loaded into registry
- registry mixins applied
- create models, apply model configs, etc
- create data sources
// applying registry mixins
registryMixins.forEach(function(registryMixin) {
// loading data sources, models, etc will be implemented as mixins
registryMixin(registry);
});
1. base mixins
var baseMixin = registry.getMixin(ModelCtor.settings.base);
// these mixins may apply other mixins
// eg. PersistedModelMixin would cobble together
// - DataAccess
// - Validation
// - Find
baseMixin(ModelCtor);
2. ds mixins
var dsMixin = registry.getMixin(ModelCtor.settings.dataSource);
dsMixin(ModelCtor);
3. user defined mixins
ModelCtor
.settings
.mixins
.map(registry.getMixin)
.forEach(execMixin);
4. global user defined mixins
registry.globalMixins.forEach(function(mixinDesc) {
if (mixinDesc.shouldBeAppliedTo(ModelCtor)) {
mixinDesc.mixin(ModelCtor);
}
});