diff --git a/src/assets/locales/en/messages.json b/src/assets/locales/en/messages.json index 94ccd96..5b4438d 100644 --- a/src/assets/locales/en/messages.json +++ b/src/assets/locales/en/messages.json @@ -394,6 +394,11 @@ "description": "Value of the option." }, + "optionTitle_clearOnBrowserStart": { + "message": "Clear data on browser start", + "description": "Title of the option." + }, + "optionTitle_notifyOnSuccess": { "message": "Show notification on success", "description": "Title of the option." diff --git a/src/background/main.js b/src/background/main.js index bd3940e..5abffea 100644 --- a/src/background/main.js +++ b/src/background/main.js @@ -67,7 +67,9 @@ async function clearDataType(dataType, options = null, enDataTypes = null) { } const dataTypes = {}; + // All *SELECTED* DataTypes if (dataType === 'allDataTypes') { + // if enDataTypes is null if (!enDataTypes) { enDataTypes = await getEnabledDataTypes(options); } @@ -327,6 +329,13 @@ function addMessageListener() { browser.runtime.onMessage.addListener(onMessage); } +async function startup() { + const options = await storage.get(optionKeys); + if (options.clearOnBrowserStart) { + await clearDataType('allDataTypes'); + } +} + async function setupUI() { await queue.add(setBrowserAction); } @@ -337,6 +346,7 @@ async function setup() { await initStorage(); } + await startup(); await setupUI(); } diff --git a/src/options/App.vue b/src/options/App.vue index e3ee7ea..09eb767 100644 --- a/src/options/App.vue +++ b/src/options/App.vue @@ -94,6 +94,12 @@ > +
+ +