Return promise results from PiskelDB and IndexedDBStorageService

This commit is contained in:
Julian Descottes 2017-10-17 02:11:08 +02:00
parent 3e779a651f
commit a69b44eaec
2 changed files with 6 additions and 6 deletions

View File

@ -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) {

View File

@ -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 () {