diff --git a/src/js/database/PiskelDatabase.js b/src/js/database/PiskelDatabase.js index e6f8e27..9aab78a 100644 --- a/src/js/database/PiskelDatabase.js +++ b/src/js/database/PiskelDatabase.js @@ -29,9 +29,7 @@ return _requestPromise(request).then(function (event) { this.db = event.target.result; return this.db; - }.bind(this)).catch(function (e) { - console.log('Failed to initialize IndexedDB, local browser saves will be unavailable.'); - }); + }.bind(this)); }; ns.PiskelDatabase.prototype.onUpgradeNeeded_ = function (event) { diff --git a/src/js/service/storage/IndexedDbStorageService.js b/src/js/service/storage/IndexedDbStorageService.js index b4d5122..bad5efc 100644 --- a/src/js/service/storage/IndexedDbStorageService.js +++ b/src/js/service/storage/IndexedDbStorageService.js @@ -7,7 +7,9 @@ }; ns.IndexedDbStorageService.prototype.init = function () { - this.piskelDatabase.init(); + this.piskelDatabase.init().catch(function (e) { + console.log('Failed to initialize PiskelDatabase, local browser saves will be unavailable.'); + }); }; ns.IndexedDbStorageService.prototype.save = function (piskel) { @@ -30,7 +32,7 @@ }; ns.IndexedDbStorageService.prototype.load = function (name) { - this.piskelDatabase.get(name).then(function (piskelData) { + return this.piskelDatabase.get(name).then(function (piskelData) { if (typeof piskelData !== 'undefined') { var serialized = piskelData.serialized; pskl.utils.serialization.Deserializer.deserialize( @@ -46,7 +48,7 @@ }; ns.IndexedDbStorageService.prototype.remove = function (name) { - this.piskelDatabase.delete(name); + return this.piskelDatabase.delete(name); }; ns.IndexedDbStorageService.prototype.getKeys = function () {