DodoApp: Cache static resources.

Change-Id: Ib1f800ea052c5f3b7929a1d325b351dfa0a6633e
diff --git a/core/installer/welcome/static/launcher.js b/core/installer/welcome/static/launcher.js
index be5f216..ab34e4c 100644
--- a/core/installer/welcome/static/launcher.js
+++ b/core/installer/welcome/static/launcher.js
@@ -25,40 +25,51 @@
 };
 
 function reloadDock() {
-  fetch("/").then(resp => resp.text()).then(resp => {
-	const tmp = document.createElement("div");
-	tmp.innerHTML = resp;
-	const apps = document.querySelector(".app-list");
-	let existing = [...document.querySelectorAll(".app-container")];
-	let current = [...tmp.querySelectorAll(".app-container")];
-	const getId = (e) => e.getAttribute("id");
-	const existingIds = existing.map(getId);
-	const currentIds = current.map(getId);
-	existing.forEach((e) => {
-	  const id = getId(e);
-	  if (!currentIds.includes(id)) {
-		e.classList.add("fadeout");
-		setTimeout(() => apps.removeChild(e), 1900);
+  fetch("/")
+	.then((resp) => {
+	  if (resp.ok) {
+		return resp.text();
+	  } else {
+		return undefined;
 	  }
-	});
-	let prevId = undefined;
-	current.forEach((c) => {
-	  const id = getId(c);
-	  if (existingIds.includes(id)) {
-		prevId = id;
+	})
+	.then((resp) => {
+	  if (!resp) {
 		return;
 	  }
-	  c.classList.add("pulsate");
-	  if (prevId) {
-		apps.insertBefore(c, document.getElementById(prevId).nextSibling);
-	  } else {
-		apps.insertBefore(c, apps.firstChild);
-	  }
-	  prevId = id;
-	});
-	initDock();
-	setTimeout(reloadDock, 5000);
-  });
+	  const tmp = document.createElement("div");
+	  tmp.innerHTML = resp;
+	  const apps = document.querySelector(".app-list");
+	  let existing = [...document.querySelectorAll(".app-container")];
+	  let current = [...tmp.querySelectorAll(".app-container")];
+	  const getId = (e) => e.getAttribute("id");
+	  const existingIds = existing.map(getId);
+	  const currentIds = current.map(getId);
+	  existing.forEach((e) => {
+		const id = getId(e);
+		if (!currentIds.includes(id)) {
+		  e.classList.add("fadeout");
+		  setTimeout(() => apps.removeChild(e), 1900);
+		}
+	  });
+	  let prevId = undefined;
+	  current.forEach((c) => {
+		const id = getId(c);
+		if (existingIds.includes(id)) {
+		  prevId = id;
+		  return;
+		}
+		c.classList.add("pulsate");
+		if (prevId) {
+		  apps.insertBefore(c, document.getElementById(prevId).nextSibling);
+		} else {
+		  apps.insertBefore(c, apps.firstChild);
+		}
+		prevId = id;
+	  });
+	  initDock();
+	})
+	.finally(() => setTimeout(reloadDock, 5000));
 }
 
 function initDock() {