Created
March 7, 2014 05:37
-
-
Save otakustay/9405819 to your computer and use it in GitHub Desktop.
构造函数式数据源合并
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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