Sfoglia il codice sorgente

Fixed a bug where song timer wouldn't get cancelled.

KrisVos130 9 anni fa
parent
commit
c4fe58fe18
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 3 1
      app/app.js

+ 3 - 1
app/app.js

@@ -1015,7 +1015,6 @@ if (Meteor.isServer) {
         }
         }
 
 
         if (Playlists.find({"songs.mid": code}).count() > 0) {
         if (Playlists.find({"songs.mid": code}).count() > 0) {
-            console.log("Code already exists!");
             return createUniqueSongId();
             return createUniqueSongId();
         } else {
         } else {
             return code;
             return code;
@@ -1125,6 +1124,9 @@ if (Meteor.isServer) {
         this.songTimer = function() {
         this.songTimer = function() {
             startedAt = Date.now();
             startedAt = Date.now();
 
 
+            if (timer !== undefined) {
+                timer.pause();
+            }
             timer = new Timer(function() {
             timer = new Timer(function() {
                 _this.skipSong();
                 _this.skipSong();
             }, songs[currentSong].duration * 1000);
             }, songs[currentSong].duration * 1000);