creative-connections/Bodylight.js-Components

View on GitHub
src_aurelia-bodylight-plugin/src/elements/audio-on-decrease.js

Summary

Maintainability
B
6 hrs
Test Coverage
import {bindable} from 'aurelia-templating';
import {AudioOnIncrease} from './audio-on-increase';
import {useView} from 'aurelia-templating';
//import {PLATFORM} from 'aurelia-pal';
//@customElement
//@useView(PLATFORM.moduleName('./audio-on-increase.html'))
@useView('./audio-on-increase.html')
export class AudioOnDecreaseCustomElement extends AudioOnIncrease {
  @bindable thresholdvalue;
  @bindable src;
  constructor() {
    super();
    //create lambda function which is added as listener later
    this.handleValueChange = e => {
      this.value = e.detail.data[this.refindex] * this.numerator / this.denominator;
      if (this.value < this.thresholdvalue) {
        if (!this.triggered) this.trigger();
      } else {
        if (this.triggered) {this.triggered = false;}
      }
    };
  }
}