All files / src/visual volumeSliderElements.js

100% Statements 5/5
100% Branches 0/0
100% Functions 2/2
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41                    31x               191x               191x 2x             31x            
/**
 * Imports the config module
 * @module config
 */
import config from "../config.js";
 
/**
 * Keeps the volume slider elements in sync.
 * @module visual/VolumeSliderElements
 */
let VolumeSliderElements = (function() {
  /**
   * Visually syncs the volume sliders so they are all the same if there
   * are more than one.
   *
   * @access public
   */
  function sync() {
    let volumeSliders = document.getElementsByClassName(
      "amplitude-volume-slider"
    );
 
    /*
			Iterates over all of the volume sliders for the song, setting the value
			to the config value.
		*/
    for (let i = 0; i < volumeSliders.length; i++) {
      volumeSliders[i].value = config.audio.volume * 100;
    }
  }
 
  /**
   * Returns the public facing methods
   */
  return {
    sync: sync
  };
})();
 
export default VolumeSliderElements;