diff options
author | Jo-Philipp Wich <jo@mein.io> | 2018-06-22 09:39:30 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2018-06-22 09:42:15 +0200 |
commit | 69782ccbccd67bac08f43b692c2a05afddb41bf0 (patch) | |
tree | bc875cd1d45d4c631a228795909766110e47b961 /modules/luci-base/htdocs/luci-static | |
parent | e380cf51f8d60193f5743651f3c683389e4ef211 (diff) |
luci-base: xhr.js: defer starting poll queue
Defer the start of the queue poll loop until the document has been loaded.
This allows all XHR.poll() invocations on the page to register their
handlers before the first batch of requests is made.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/xhr.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/xhr.js b/modules/luci-base/htdocs/luci-static/resources/xhr.js index de4476cdd..f1537a448 100644 --- a/modules/luci-base/htdocs/luci-static/resources/xhr.js +++ b/modules/luci-base/htdocs/luci-static/resources/xhr.js @@ -204,7 +204,6 @@ XHR.poll = function(interval, url, data, callback, post) }; XHR._q.push(e); - XHR.run(); return e; } @@ -260,3 +259,5 @@ XHR.running = function() { return !!(XHR._r && XHR._i); } + +document.addEventListener('DOMContentLoaded', XHR.run); |