From 676a6abe4e486b5e7e6b044d82468ceaf9b5092b Mon Sep 17 00:00:00 2001 From: Lauchmelder Date: Wed, 30 Mar 2022 16:37:47 +0200 Subject: [PATCH] level number updates in realtime --- src/background.js | 2 +- src/popup.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index d3d3c84..343f372 100644 --- a/src/background.js +++ b/src/background.js @@ -140,7 +140,7 @@ const sync = () => // If the wanikani level differs from the local level, update the cache if(level !== data.level) - updateCache(data.token, data.level, level) + await updateCache(data.token, data.level, level) chrome.storage.local.set({"validUserLevel": true}) resolve("Successfully synchronized data!") diff --git a/src/popup.js b/src/popup.js index 5fa342f..faf61a8 100644 --- a/src/popup.js +++ b/src/popup.js @@ -68,6 +68,12 @@ submitButton.addEventListener( "click", () => { { statusField.innerHTML = String.fromCodePoint(0x2705) errorField.innerHTML = "" + + // Update the users current WaniKani level + chrome.storage.local.get("level", (data) => { + const levelSpan = document.getElementById("level") + levelSpan.innerHTML = data.level + }) } else {