From 2d66565c3578388492426575b65acc55a1a079cf Mon Sep 17 00:00:00 2001 From: wanhose Date: Mon, 5 Jul 2021 18:07:37 +0200 Subject: [PATCH] feat(scripts): clear storage when update --- scripts/background.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/background.js b/scripts/background.js index 05363d9..daed699 100644 --- a/scripts/background.js +++ b/scripts/background.js @@ -204,7 +204,7 @@ const updateState = (tabId, state) => { }; /** - * @description Listens to content messages + * @description Listens to messages */ chrome.runtime.onMessage.addListener((request, sender, responseCallback) => { @@ -252,3 +252,13 @@ chrome.runtime.onMessage.addListener((request, sender, responseCallback) => { return true; }); + +/** + * @description Listens to updates + */ + +chrome.runtime.onInstalled.addListener((reason) => { + if (reason === chrome.runtime.OnInstalledReason.UPDATE) { + chrome.storage.local.clear(); + } +});