mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-25 19:23:55 +00:00
restore: Auto-cleanup when an IndexedDBStore is created.
This commit is contained in:
parent
a542fdf42d
commit
2f14aa8a6e
1 changed files with 13 additions and 1 deletions
|
|
@ -60,6 +60,7 @@ function waitForRequest (request) {
|
|||
})
|
||||
}
|
||||
|
||||
let cleanedUp = false
|
||||
class IndexedDBStore {
|
||||
constructor (core, opts) {
|
||||
this.opts = Object.assign({
|
||||
|
|
@ -70,7 +71,18 @@ class IndexedDBStore {
|
|||
}, opts)
|
||||
|
||||
this.name = this.opts.storeName
|
||||
this.ready = connect(this.opts.dbName)
|
||||
|
||||
const createConnection = () => {
|
||||
return connect(this.opts.dbName)
|
||||
}
|
||||
|
||||
if (!cleanedUp) {
|
||||
cleanedUp = true
|
||||
this.ready = IndexedDBStore.cleanup()
|
||||
.then(createConnection, createConnection)
|
||||
} else {
|
||||
this.ready = createConnection
|
||||
}
|
||||
}
|
||||
|
||||
key (fileID) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue