Skip to content

Instantly share code, notes, and snippets.

@otakustay
Created March 7, 2014 05:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save otakustay/9405819 to your computer and use it in GitHub Desktop.
Save otakustay/9405819 to your computer and use it in GitHub Desktop.
构造函数式数据源合并
var LOAD_ENTITY = {
entity: function (model) {
return model.findById(model.get('id'));
}
};
var TRANSLATE_NAME = {
name: function (model) {
return mode.get('lastName') + ' ' + model.get('firstName');
}
}
function BaseModel() {
this.putDatasource(LOAD_ENTITY, 0);
this.putDatasource(TRANSLATE_NAME, 1);
}
var LOAD_USER_LIST = {
list: function (model) {
return model.list();
}
};
function Child() {
Base.apply(this, arguments);
this.putDatasource(LOAD_USER_LIST, 0);
}
inherits(Child, Base);
// LOAD_ENTITY + LOAD_USER
// TRANSLATE_NAME
// loaded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment