From 8544f48f0c37845568134d9b5913d85718127037 Mon Sep 17 00:00:00 2001 From: Prateek Surana Date: Sun, 22 Mar 2020 18:12:35 +0530 Subject: [PATCH] :bug: Fixed chrome storage getting cleared on extension update --- background.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index a9ccff1..945383b 100644 --- a/background.js +++ b/background.js @@ -8,8 +8,10 @@ function getUrlWithoutHash(url) { return url.split("?")[0]; } -chrome.runtime.onInstalled.addListener(() => { - chrome.storage.local.set({ "scroll-mark": {} }); +chrome.runtime.onInstalled.addListener(details => { + if (details.reason === "install") { + chrome.storage.local.set({ "scroll-mark": {} }); + } }); const updateIcon = () => {