Skip to content

Commit feff4d4

Browse files
committed
bam
1 parent 6c795c8 commit feff4d4

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

v3/js/opt-frontend-common.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,13 +1022,13 @@ function genericOptFrontendReady() {
10221022
// have one. beforeunload seems to work better than unload(), but it's
10231023
// still a bit flaky ... TODO: investigate :(
10241024
$(window).on('beforeunload', function(){
1025-
submitUpdateHistory();
1025+
submitUpdateHistory('beforeunload');
10261026
return null; // so that no dialog is triggered
10271027
});
10281028

10291029
// just do this as well, even though it might be hella redundant
10301030
$(window).unload(function(){
1031-
submitUpdateHistory();
1031+
submitUpdateHistory('unload');
10321032
return null; // so that no dialog is triggered
10331033
});
10341034

@@ -1037,7 +1037,7 @@ function genericOptFrontendReady() {
10371037
// re-editing code; that way, we can still get some signals rather
10381038
// than nothing.
10391039
setInterval(function() {
1040-
submitUpdateHistory(true);
1040+
submitUpdateHistory('periodic');
10411041
}, 1000 * 60);
10421042
}
10431043

@@ -1200,7 +1200,7 @@ function updateAppDisplay(newAppMode) {
12001200
// Back button flow
12011201
$("#pyOutputPane").empty();
12021202
// right before destroying, submit the visualizer's updateHistory
1203-
submitUpdateHistory();
1203+
submitUpdateHistory('editMode');
12041204
myVisualizer = null;
12051205

12061206
$(document).scrollTop(0); // scroll to top to make UX better on small monitors
@@ -1614,10 +1614,7 @@ function executeCodeAndCreateViz(codeToExec,
16141614

16151615
// this feature was deployed on 2015-09-17, so check logs for
16161616
// viz_interaction.py
1617-
//
1618-
// isPeriodic means it's an automatically-sent signal rather than one
1619-
// triggered on a specific event such as a page unload or edit mode switch
1620-
function submitUpdateHistory(isPeriodic) {
1617+
function submitUpdateHistory(why) {
16211618
if (myVisualizer) {
16221619
// Compress updateHistory before encoding and sending to
16231620
// the server so that it takes up less room in the URL. Have each
@@ -1647,8 +1644,8 @@ function submitUpdateHistory(isPeriodic) {
16471644

16481645
var myArgs = {session_uuid: sessionUUID,
16491646
updateHistoryJSON: encodedUhJSON};
1650-
if (isPeriodic) {
1651-
myArgs.isPeriodic = true;
1647+
if (why) {
1648+
myArgs.why = why;
16521649
}
16531650
$.get('viz_interaction.py', myArgs, function(dat) {});
16541651
}

0 commit comments

Comments
 (0)