Skip to content

Commit

Permalink
make a top level reference to QuizTakingPolice
Browse files Browse the repository at this point in the history
fixes CNVS-28931

TEST PLAN:
 1) build a timed quiz
 2) take quiz in Chrome 50
 3) timer should work

Change-Id: I93d8f591197bd7d1efed5ef13fba0df44abca3f1
  • Loading branch information
evizitei committed Apr 26, 2016
1 parent ed44230 commit d4eba9e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions public/javascripts/take_quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ define([
var lastAnswerSelected = null;
var lastSuccessfulSubmissionData = null;
var showDeauthorizedDialog;

// need to keep a top level reference or
// it can get garbage collected
var quizTakingPoliceTopLevel = null;

var quizSubmission = (function() {
var timeMod = 0,
endAt = $(".end_at"),
Expand Down Expand Up @@ -672,15 +677,15 @@ define([
}, 2000);

if (QuizTakingPolice) {
var quizTakingPolice = new QuizTakingPolice();
quizTakingPoliceTopLevel = new QuizTakingPolice();

quizTakingPolice.addEventListener('message', function(e) {
quizTakingPoliceTopLevel.addEventListener('message', function(e) {
if (e.data === 'stopwatchTick') {
quizSubmission.updateTime();
}
});

quizTakingPolice.postMessage({
quizTakingPoliceTopLevel.postMessage({
code: 'startStopwatch',
frequency: quizSubmission.clockInterval
});
Expand Down

0 comments on commit d4eba9e

Please sign in to comment.