Skip to content

Commit

Permalink
Check for already finished IDB transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Sep 7, 2024
1 parent 7e0bcb5 commit 3f51fe7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
38 changes: 22 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"typescript": "5.2.2"
},
"peerDependencies": {
"@zenfs/core": ">=0.12.10"
"@zenfs/core": ">=0.17.1"
},
"keywords": [
"filesystem",
Expand Down
8 changes: 8 additions & 0 deletions src/IndexedDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,18 @@ export class IndexedDBTransaction extends AsyncTransaction<IndexedDBStore> {
}

public async commit(): Promise<void> {
if(this.done) {
return;
}
this.done = true;
this.tx.commit();
}

public async abort(): Promise<void> {
if(this.done) {
return;
}
this.done = true;
try {
this.tx.abort();
} catch (e) {
Expand Down

0 comments on commit 3f51fe7

Please sign in to comment.