Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
name files per table correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
rhelmer committed Aug 1, 2022
1 parent fd04738 commit 3c80f93
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions extensions/attention-stream/public/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,14 @@ document.getElementById("toggleEnabled").addEventListener("click", async event =
document.getElementById("download").addEventListener("click", async () => {
const db = new Dexie(DB_NAME);
await db.open();
// Sort using index, @see `src/background.ts`
const journeys = await db.table("user-journey").orderBy("user_journey_page_visit_stop_date_time").toArray();
const advertisements = await db.table("advertisements").toArray();
const articleContents = await db.table("article-contents").toArray();

for (const table of [journeys, advertisements, articleContents]) {
const dataUrl = (`data:application/json,${encodeURIComponent(JSON.stringify(table, null, 2))}`);
for (const tableName of ["user-journey", "advertisements", "article-contents"]) {
const tableContents = await db.table(tableName).toArray();
const dataUrl = (`data:application/json,${encodeURIComponent(JSON.stringify(tableContents, null, 2))}`);

const downloadLink = document.getElementById("downloadLink");
downloadLink.setAttribute("href", dataUrl);
downloadLink.setAttribute("download", `rally-attention-stream-${table}.json`);
downloadLink.setAttribute("download", `rally-attention-stream-${tableName}.json`);
downloadLink.click();
}
});
Expand Down

0 comments on commit 3c80f93

Please sign in to comment.