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

Commit

Permalink
Merge pull request #22541 from icecream17/patch-1
Browse files Browse the repository at this point in the history
Recreate #15175
  • Loading branch information
sadick254 committed Jun 7, 2021
2 parents f5c3e99 + 9ac3924 commit 83ffb7a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/state-store.js
Expand Up @@ -13,13 +13,24 @@ module.exports = class StateStore {
const dbOpenRequest = indexedDB.open(this.databaseName, this.version);
dbOpenRequest.onupgradeneeded = event => {
let db = event.target.result;
db.onerror = error => {
atom.notifications.addFatalError('Error loading database', {
stack: new Error('Error loading database').stack,
dismissable: true
});
console.error('Error loading database', error);
};
db.createObjectStore('states');
};
dbOpenRequest.onsuccess = () => {
this.connected = true;
resolve(dbOpenRequest.result);
};
dbOpenRequest.onerror = error => {
atom.notifications.addFatalError('Could not connect to indexedDB', {
stack: new Error('Could not connect to indexedDB').stack,
dismissable: true
});
console.error('Could not connect to indexedDB', error);
this.connected = false;
resolve(null);
Expand Down

0 comments on commit 83ffb7a

Please sign in to comment.