From bc2bf2eb5a4609a1570de941476a3bed1c34fa14 Mon Sep 17 00:00:00 2001 From: Darren Date: Sat, 18 Oct 2014 18:30:38 +0100 Subject: [PATCH] index.html comments --- client/src/index.html.tmpl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/client/src/index.html.tmpl b/client/src/index.html.tmpl index a67bc72..71c1d00 100644 --- a/client/src/index.html.tmpl +++ b/client/src/index.html.tmpl @@ -474,9 +474,12 @@ window.onload = resolve; }); + // Get a resolve function for the script loading promises script_promise = new Promise(function (resolve) { script_promise_resolve = resolve; }); + + // Chain each script loading promise script_promise = script_promise.then(function () { var idx; for (idx = 0; idx < scripts.length; idx++) { @@ -488,6 +491,7 @@ } }); + // Debugging will get a list of debugging scripts from settings.json (below) if (!getQueryVariable('debug')) { scripts.push(['assets/libs/lodash.min.js?t=<%build_time%>']); scripts.push([ @@ -537,7 +541,16 @@ }); }); - Promise.all([onload_promise, settings_promise]).then(function(){return script_promise}).then(function startApp() { + // prawnsalad: Why is the below script_promise in its own .then()? + // M2Ys4U: prawnsalad: either of the first two promises can resolve the + // third one, but the third one has a then() on it already, so the + // then() on the all() makes it wait for the then() on the script promise + // to resolve. + // + // Promises - simple. + Promise.all([onload_promise, settings_promise]) + .then(function(){return script_promise}) + .then(function startApp() { // Kiwi IRC version this is built from kiwi.build_version = '<%build_version%>'; -- 2.25.1