Created
September 26, 2013 19:15
-
-
Save amb26/6719152 to your computer and use it in GitHub Desktop.
Current base model hierarchy
This file contains 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
/** MODEL COMPONENT HIERARCHY **/ | |
fluid.initSimpleModel = function (that, optionsModel) { | |
return that.model = optionsModel || {}; | |
}; | |
fluid.initRelayModel = function (that, optionsModel, applier) { | |
return optionsModel || {}; | |
}; | |
fluid.establishModelRelay = function (that, model, optionsModel, optionsML, applier) { | |
// build up here | |
fluid.mergeModelListeners(that, optionsML); | |
applier.initModelEvent(); | |
}; | |
// Grade common to "old" and "new" model components | |
fluid.defaults("fluid.commonModelComponent", { | |
gradeNames: ["fluid.littleComponent", "autoInit"], | |
mergePolicy: { | |
modelListeners: fluid.makeMergeListenersPolicy(fluid.arrayConcatPolicy) | |
} | |
}); | |
fluid.defaults("fluid.modelComponent", { | |
gradeNames: ["fluid.commonModelComponent", "autoInit"], | |
members: { | |
model: "@expand:fluid.initSimpleModel({that}, {that}.options.model)", | |
applier: "@expand:fluid.makeChangeApplier({that}.model, {that}.options.changeApplierOptions)", | |
modelListeners: "@expand:fluid.mergeModelListeners({that}, {that}.options.modelListeners)" | |
}, | |
mergePolicy: { | |
model: "preserve" | |
} | |
}); | |
fluid.defaults("fluid.modelRelayComponent", { | |
gradeNames: ["fluid.commonModelComponent", "fluid.eventedComponent", "autoInit"], | |
members: { | |
model: "@expand:fluid.initRelayModel({that}, {that}.options.model, {that}.applier)", | |
applier: "@expand:fluid.makeHolderChangeApplier({that}, {that}.options.changeApplierOptions)", | |
modelRelay: "@expand:fluid.establishModelRelay({that}, {that}.model, {that}.options.model, {that}.options.modelListeners, {that}.applier)" | |
}, | |
mergePolicy: { | |
modelRelay: fluid.arrayConcatPolicy | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment