All files / src/events volumeSlider.js

40% Statements 2/5
0% Branches 0/2
50% Functions 1/2
40% Lines 2/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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63                                                      31x                                                         31x            
/**
 * Imports the config to use the values
 */
import config from "../config.js";
 
/**
 * Imports the AmplitudeJS Core Methods
 * @module core/core
 */
import Core from "../core/core.js";
 
/**
 * Imports the AmplitudeJS Visual Mute Elements
 * @module visual/MuteElements
 */
import MuteElements from "../visual/muteElements.js";
 
/**
 * Imports the AmplitudeJS Visual Volume Slider Elements
 * @module visual/VolumeSliderElements
 */
import VolumeSliderElements from "../visual/volumeSliderElements.js";
 
/**
 * Handles all events for a volume up event.
 * @module events/VolumeSlider
 */
let VolumeSlider = (function() {
  /**
   * Handles a change on the volume slider
   *
   * HANDLER FOR:       class="amplitude-volume-slider"
   *
   * @access public
   */
  function handle() {
    /*
			Calls the core function to set the volume to the computed value
			based on the user's intent.
		*/
    Core.setVolume(this.value);
 
    /*
      Sync Mute Elements.
    */
    MuteElements.setMuted(config.volume == 0 ? true : false);
 
    /*
			Sync the volume slider locations
		*/
    VolumeSliderElements.sync();
  }
 
  /**
   * Returns the public facing methods
   */
  return {
    handle: handle
  };
})();
 
export default VolumeSlider;