Skip to content

Commit

Permalink
feat: remove unuse index and export
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Salatskyi authored and Anton Salatskyi committed Sep 25, 2023
1 parent 42a4bd1 commit ac22098
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
15 changes: 1 addition & 14 deletions db/idb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@ export default function(): Promise<IDBDatabase> {
return db.createObjectStore(storeName, options);
}
}
function createIndex(
store: IDBObjectStore,
indexName: string,
keyPath: ReadonlyArray<string>,
options: IDBIndexParameters,
): void {
if (store.indexNames.contains(indexName)) {
return;
} else {
store.createIndex(indexName, keyPath, options);
}
}
function removeUnusedIndexes(
store: IDBObjectStore,
indexNames: ReadonlyArray<string>,
Expand All @@ -53,8 +41,7 @@ export default function(): Promise<IDBDatabase> {
keyPath: "id",
autoIncrement: true
});
removeUnusedIndexes(store, ["id", "title"]);
createIndex(store, "title", ["title"], { unique: false });
removeUnusedIndexes(store, ["id"]);
};
});
};
1 change: 0 additions & 1 deletion db/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * as Idb from "./idb";
export * as Note from "./note";

0 comments on commit ac22098

Please sign in to comment.