All files / src/events repeatSong.js

100% Statements 5/5
50% Branches 1/2
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59                                              31x                         4x       4x         4x             31x            
/**
 * Imports the config module
 * @module config
 */
import config from "../config.js";
 
/**
 * Imports the repeat utility
 * @module utilities/Repeater
 */
import Repeater from "../utilities/repeater.js";
 
/**
 * Imports the AmplitudeJS Repeat Element
 * @module visual/RepeatElements
 */
import RepeatElements from "../visual/repeatElements.js";
 
/**
 * Handles an event on the Amplitude Repeat Song.
 *
 * @module events/RepeatSong
 */
let RepeatSong = (function() {
  /**
   * Handles an event on the repeat song button
   *
   * HANDLER FOR: 'amplitude-repeat-song'
   *
   * @access public
   */
  function handle() {
    /*
      If the touch is moving, we do not want to accidentally touch the play
      pause element and fire an event.
    */
    Eif (!config.is_touch_moving) {
      /*
				Sets repeat song to the opposite of what it was set to
			*/
      Repeater.setRepeatSong(!config.repeat_song);
 
      /*
				Visually sync repeat song
			*/
      RepeatElements.syncRepeatSong();
    }
  }
 
  /**
   * Returns the public facing methods
   */
  return {
    handle: handle
  };
})();
 
export default RepeatSong;