Gunnar Bittersmann: JavaScript

Beitrag lesen

@@Felix Riesterer

  loadData () {
    this.Status = getState('sun2000.' + this.index + '.collected.SOC').val;
    this.LadungEntladung = getState('sun2000.' + this.index + '.collected.chargeDischargePower').val;
  }

Yikes! Warum die unübersichtliche Schreibweise? Template-Literale machen das lesbarer:

  loadData () {
    this.Status = getState(`sun2000.${this.index}.collected.SOC`).val;
    this.LadungEntladung = getState(`sun2000.${this.index}.collected.chargeDischargePower`).val;
  }

Kwakoni Yiquan

--
Ad astra per aspera