From 112109d07c1ed1d7dcb4bda338b843e26119af7a Mon Sep 17 00:00:00 2001 From: Ross Date: Sun, 28 Feb 2021 16:18:56 +0000 Subject: [PATCH] . --- js/main.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/js/main.js b/js/main.js index 0080592..6f94611 100644 --- a/js/main.js +++ b/js/main.js @@ -448,26 +448,37 @@ function setUpPacket(data, path) { var request_numbers = []; // For loop to generate requests + (async () => { for (const n in data["questions"]) { const question_url = `${path}/${n}`; question_number++; console.log("Creating ", question_url, question_number, question_total); //$("#progress").html(`Downloading [${question_number}/${question_total}]`); - const request = interact.getQuestion( + const question_json = await interact.getQuestion( question_url, question_number, question_total ); - requests.push(request) - request_numbers.push(n) - //data["questions"][n] = question_json; + //requests.push(request) + //request_numbers.push(n) + data["questions"][n] = question_json; } + loadSession(); + })() - $.when.apply($,requests).then(function(){ - console.log(arguments); //array of responses [0][data, status, xhrObj],[1][data, status, xhrObj]... - }) + + //(async () => { + // for(let f of requests){ + // var json = await f; + // console.log(json) + //}; + //})() + + //$.when.apply($,requests).then(function(){ + // console.log(arguments); //array of responses [0][data, status, xhrObj],[1][data, status, xhrObj]... + //}) } else { // Just carry on loading