mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: adding dexie
This commit is contained in:
parent
f860439fb5
commit
d97c5b894a
1 changed files with 12 additions and 20 deletions
|
@ -1,43 +1,35 @@
|
||||||
import { db, downloadSourcesTable, repacksTable } from "@renderer/dexie";
|
// import { db, downloadSourcesTable, repacksTable } from "@renderer/dexie";
|
||||||
import { DownloadSource, GameRepack } from "@types";
|
import { DownloadSource, GameRepack } from "@types";
|
||||||
|
|
||||||
export type Payload = [DownloadSource[], GameRepack[]];
|
export type Payload = [DownloadSource[], GameRepack[]];
|
||||||
|
|
||||||
self.onmessage = async (event: MessageEvent<Payload>) => {
|
self.onmessage = async (_event: MessageEvent<Payload>) => {
|
||||||
const [downloadSources, gameRepacks] = event.data;
|
// const [downloadSources, gameRepacks] = event.data;
|
||||||
|
// const downloadSourcesCount = await downloadSourcesTable.count();
|
||||||
const downloadSourcesCount = await downloadSourcesTable.count();
|
// if (downloadSources.length > downloadSourcesCount) {
|
||||||
|
// await db.transaction(
|
||||||
if (downloadSources.length > downloadSourcesCount) {
|
// "rw",
|
||||||
await db.transaction(
|
// downloadSourcesTable,
|
||||||
"rw",
|
// repacksTable,
|
||||||
downloadSourcesTable,
|
// async () => {}
|
||||||
repacksTable,
|
// );
|
||||||
async () => {}
|
// }
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (type === "MIGRATE_DOWNLOAD_SOURCES") {
|
// if (type === "MIGRATE_DOWNLOAD_SOURCES") {
|
||||||
// const dexieDownloadSources = await downloadSourcesTable.count();
|
// const dexieDownloadSources = await downloadSourcesTable.count();
|
||||||
|
|
||||||
// if (data.length > dexieDownloadSources) {
|
// if (data.length > dexieDownloadSources) {
|
||||||
// await downloadSourcesTable.clear();
|
// await downloadSourcesTable.clear();
|
||||||
// await downloadSourcesTable.bulkAdd(data);
|
// await downloadSourcesTable.bulkAdd(data);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// self.postMessage("MIGRATE_DOWNLOAD_SOURCES_COMPLETE");
|
// self.postMessage("MIGRATE_DOWNLOAD_SOURCES_COMPLETE");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (type === "MIGRATE_REPACKS") {
|
// if (type === "MIGRATE_REPACKS") {
|
||||||
// const dexieRepacks = await repacksTable.count();
|
// const dexieRepacks = await repacksTable.count();
|
||||||
|
|
||||||
// if (data.length > dexieRepacks) {
|
// if (data.length > dexieRepacks) {
|
||||||
// await repacksTable.clear();
|
// await repacksTable.clear();
|
||||||
// await repacksTable.bulkAdd(
|
// await repacksTable.bulkAdd(
|
||||||
// data.map((repack) => ({ ...repack, uris: JSON.stringify(repack.uris) }))
|
// data.map((repack) => ({ ...repack, uris: JSON.stringify(repack.uris) }))
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// self.postMessage("MIGRATE_REPACKS_COMPLETE");
|
// self.postMessage("MIGRATE_REPACKS_COMPLETE");
|
||||||
// }
|
// }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue