Explorar o código

Fixed SoundCloud song playing on Dashboard bug.

KrisVos130 %!s(int64=9) %!d(string=hai) anos
pai
achega
529e728269
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      app/app.js

+ 5 - 1
app/app.js

@@ -13,6 +13,7 @@ if (Meteor.isClient) {
 
 
     Meteor.subscribe("queues");
     Meteor.subscribe("queues");
 
 
+    var minterval;
     var hpSound = undefined;
     var hpSound = undefined;
     var songsArr = [];
     var songsArr = [];
     var ytArr = [];
     var ytArr = [];
@@ -190,6 +191,9 @@ if (Meteor.isClient) {
 
 
     Template.dashboard.onCreated(function() {
     Template.dashboard.onCreated(function() {
         if (_sound !== undefined) _sound.stop();
         if (_sound !== undefined) _sound.stop();
+        if (minterval !== undefined) {
+            Meteor.clearInterval(minterval);
+        }
         Meteor.subscribe("history");
         Meteor.subscribe("history");
     });
     });
 
 
@@ -647,7 +651,7 @@ if (Meteor.isClient) {
                 window.location = "/";
                 window.location = "/";
             } else {
             } else {
                 Session.set("loaded", true);
                 Session.set("loaded", true);
-                Meteor.setInterval(function () {
+                minterval = Meteor.setInterval(function () {
                     var data = undefined;
                     var data = undefined;
                     var dataCursorH = History.find({type: type});
                     var dataCursorH = History.find({type: type});
                     var dataCursorP = Playlists.find({type: type});
                     var dataCursorP = Playlists.find({type: type});