Created
April 6, 2018 21:28
-
-
Save leondmello/ae0d15e2fe051d6b16d4b898cf750aa3 to your computer and use it in GitHub Desktop.
Memoizer app model
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
import DS from 'ember-data'; | |
import ModelMixin from 'ember-data-extensions/mixins/model'; | |
import _ from 'lodash'; | |
const AppModel = DS.Model.extend(ModelMixin); | |
const modelViewName = _.memoize(function () { | |
<some code> | |
}, function () { | |
return this.modelName; | |
}); | |
const attributeLabels = _.memoize(function (store) { | |
<some code> | |
}, function () { | |
return this.modelName; | |
}); | |
export default AppModel.extend({ | |
}).reopenClass({ | |
overriddenModelViewName: () => {}, | |
overriddenAttributeLabels: () => {}, | |
modelViewName: modelViewName, | |
attributeLabels: attributeLabels | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment