]> git.sesse.net Git - remoteglot/blobdiff - www/js/remoteglot.js
Fix another bug with sound play with JSON deltas they are applied in-place).
[remoteglot] / www / js / remoteglot.js
index d34b4d6bf8767675952e892f264e11641159abcf..43b2e1ddbb7c304b2450349fbaef79e23e355d92 100644 (file)
@@ -137,12 +137,15 @@ var request_update = function() {
                sync_server_clock(xhr.getResponseHeader('Date'));
                ims = xhr.getResponseHeader('X-RGLM');
                var num_viewers = xhr.getResponseHeader('X-RGNV');
-               possibly_play_sound(current_analysis_data, data);
+               var new_data;
                if (Array.isArray(data)) {
-                       current_analysis_data = JSON_delta.patch(current_analysis_data, data);
+                       new_data = JSON.parse(JSON.stringify(current_analysis_data));
+                       JSON_delta.patch(new_data, data);
                } else {
-                       current_analysis_data = data;
+                       new_data = data;
                }
+               possibly_play_sound(current_analysis_data, new_data);
+               current_analysis_data = new_data;
                update_board(current_analysis_data, displayed_analysis_data);
                update_num_viewers(num_viewers);