From e99f1bd6369a078e371887b3b0689f972711174b Mon Sep 17 00:00:00 2001 From: Niko Date: Fri, 25 Feb 2022 15:34:44 +0100 Subject: [PATCH] Improve pages.home preloading when loading pages.quiz --- web/src/app/js/app.js | 7 +++++++ web/src/app/js/pages/quiz.js | 1 + 2 files changed, 8 insertions(+) diff --git a/web/src/app/js/app.js b/web/src/app/js/app.js index bf001c7..3edc7ca 100644 --- a/web/src/app/js/app.js +++ b/web/src/app/js/app.js @@ -460,6 +460,13 @@ function scriptPageHandler(modname, cfg) { } app.preload = { + home: function() { + app.script('pages.home'); + app.template.loadMany([ + 'home.index', + 'home.quiz_item', + ]); + }, quiz: function() { app.script('pages.quiz'); app.template.loadMany([ diff --git a/web/src/app/js/pages/quiz.js b/web/src/app/js/pages/quiz.js index 58906ca..7a49caa 100644 --- a/web/src/app/js/pages/quiz.js +++ b/web/src/app/js/pages/quiz.js @@ -25,6 +25,7 @@ app.pages.quiz = { window.prevHash === '') animateTimeout('#quiz', 'slide-from-right'); page().setDragEvent(); + app.preload.home(); }; if (data === undefined) http.get(`/api/v1/me/quizs?id=${args[1]}`,