このモデルには静的列挙セットがあります
Ext.define('MyApp.model.RefreshableComponent', {
statics: {
RefreshIntervals: {
ONEMIN: 1,
FIVEMINS: 2,
TENMINS: 3,
FIFTEENMINS: 4,
DEFAULT: 5
}
}
});
そして、私はそのように別のクラスでそれにアクセスしています
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);
}
},
int値ではなく、refreshIntervalの名前をログに表示したいと思います。これについてどうすればいいですか?
可読性の理由から、名前を int ではなくパラメーターとして渡すことができる限り、この列挙型を別の方法で定義することにオープンです。