From 2a19aeb6a30dbd6a485f19ad42ad75580e5836d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Sat, 8 Jun 2019 16:29:01 +0200 Subject: [PATCH] [REF] extras: start loading templates earlier --- extras/playground/app.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/extras/playground/app.js b/extras/playground/app.js index e5265818..c48c7d5a 100644 --- a/extras/playground/app.js +++ b/extras/playground/app.js @@ -352,11 +352,15 @@ class TabbedEditor extends owl.Component { //------------------------------------------------------------------------------ // Application initialization //------------------------------------------------------------------------------ -document.title = `${document.title} (v${owl.__info__.version})`; -document.addEventListener("DOMContentLoaded", async function() { +async function start() { + document.title = `${document.title} (v${owl.__info__.version})`; const templates = await owl.utils.loadTemplates("templates.xml"); const qweb = new owl.QWeb(templates); const env = { qweb }; - const app = new App(env); - app.mount(document.body); -}); + owl.utils.whenReady(() => { + const app = new App(env); + app.mount(document.body); + }); +} + +start();