Skip to content

Commit

Permalink
Corrected queueing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaifroid committed Sep 16, 2018
1 parent 10ec43c commit 4f3d73e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions www/js/app.js
Expand Up @@ -927,7 +927,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles
iframeArticleContent.src = "article.html";

/**
* Add a function to a queue. Functions will be executed only when val1 >= val2
* Add a function to a queue. Functions will be executed only when val1 === val2
* @param {Function} fn Function to be queued
* @param {Integer} val1 An incremental counter
* @param {Integer} val2 The total count
Expand All @@ -944,10 +944,10 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles

function queueControl() {
if (!pageState.fnQueue.length) return;
if (pageState[pageState.fnQueue[0].val1] >= pageState[pageState.fnQueue[0].val2]) {
if (pageState[pageState.fnQueue[0].val1] === pageState[pageState.fnQueue[0].val2]) {
var nextFn = pageState.fnQueue[0].fn;
console.log('Starting function ' + nextFn.name + ': ' + pageState[pageState.fnQueue[0].val1] + ' = ' + pageState[pageState.fnQueue[0].val2]);
pageState.fnQueue.shift();
console.log('Starting function ' + nextFn.name);
nextFn();
queueControl();
} else {
Expand Down

0 comments on commit 4f3d73e

Please sign in to comment.