mirror of
https://github.com/XFox111/TabsAsideExtension.git
synced 2026-04-22 07:58:01 +03:00
fix: corrupted json export
This commit is contained in:
@@ -4,13 +4,16 @@ export default async function exportData(): Promise<void>
|
|||||||
local: await browser.storage.local.get(null),
|
local: await browser.storage.local.get(null),
|
||||||
sync: await browser.storage.sync.get(null)
|
sync: await browser.storage.sync.get(null)
|
||||||
});
|
});
|
||||||
|
const blob: Blob = new Blob([data], { type: "application/json" });
|
||||||
|
|
||||||
const element: HTMLAnchorElement = document.createElement("a");
|
const element: HTMLAnchorElement = document.createElement("a");
|
||||||
element.style.display = "none";
|
element.style.display = "none";
|
||||||
element.href = `data:application/json;charset=utf-8,${data}`;
|
element.href = URL.createObjectURL(blob);
|
||||||
element.setAttribute("download", "tabs-aside_data.json");
|
element.setAttribute("download", "tabs-aside_data.json");
|
||||||
|
|
||||||
document.body.appendChild(element);
|
document.body.appendChild(element);
|
||||||
element.click();
|
element.click();
|
||||||
|
|
||||||
|
URL.revokeObjectURL(element.href);
|
||||||
document.body.removeChild(element);
|
document.body.removeChild(element);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user