Add some utilities to the options page to dump the settings and backup data.

This commit is contained in:
Bauke 2020-11-26 18:31:13 +01:00
parent f00b4161c3
commit d20a98c0a4
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
3 changed files with 24 additions and 1 deletions

View File

@ -3,7 +3,7 @@
"manifest_version": 2, "manifest_version": 2,
"name": "Queue", "name": "Queue",
"description": "A WebExtension for queueing links.", "description": "A WebExtension for queueing links.",
"version": "0.1.6", "version": "0.1.7",
"permissions": [ "permissions": [
"contextMenus", "contextMenus",
"storage", "storage",

View File

@ -1,6 +1,7 @@
import {html, render} from 'htm/preact'; import {html, render} from 'htm/preact';
import { import {
initializeBackgroundMessageHandler, initializeBackgroundMessageHandler,
log,
getManifest, getManifest,
getSettings, getSettings,
PageFooter, PageFooter,
@ -12,6 +13,15 @@ import {
(async () => { (async () => {
initializeBackgroundMessageHandler(); initializeBackgroundMessageHandler();
window.HollloQueue = {
dumpBackup: async () => {
log(JSON.stringify(await browser.storage.local.get(), null, 2));
},
dumpSettings: async () => {
log(JSON.stringify(await getSettings(), null, 2));
}
};
const manifest = getManifest(); const manifest = getManifest();
const settings = await getSettings(); const settings = await getSettings();

13
source/types.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
// TypeScript fix to make it see this file as a module.
export {};
type HollloQueue = {
dumpBackup: () => Promise<void>;
dumpSettings: () => Promise<void>;
};
declare global {
interface Window {
HollloQueue: HollloQueue;
}
}