I’ve got this model with a static enumeration set
Ext.define('MyApp.model.RefreshableComponent', {
statics: {
RefreshIntervals: {
ONEMIN: 1,
FIVEMINS: 2,
TENMINS: 3,
FIFTEENMINS: 4,
DEFAULT: 5
}
}
});
and I’m accessing it in another class like so
updateDefaultTask: function () {
this.updateTask(MyApp.model.RefreshableComponent.RefreshIntervals.DEFAULT);
},
updateTask: function (refreshInterval) {
var components = this.getVisibleComponentsByRefreshInterval(refreshInterval);
if (this.debugMode) {
console.log("REFRESHMANAGER: Triggered the update task " + refreshInterval);
}
},
I would like to display the name of the refreshInterval in the log, not the int value. How can I go about this?
I’m open to defining this enumeration in a different way, as long as I can still pass in the name as a parameter, rather than the int, for readability reasons.
Ext has the Ext.Object.getKey() method: