mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Return promise results from PiskelDB and IndexedDBStorageService
This commit is contained in:
parent
3e779a651f
commit
a69b44eaec
@ -29,9 +29,7 @@
|
|||||||
return _requestPromise(request).then(function (event) {
|
return _requestPromise(request).then(function (event) {
|
||||||
this.db = event.target.result;
|
this.db = event.target.result;
|
||||||
return this.db;
|
return this.db;
|
||||||
}.bind(this)).catch(function (e) {
|
}.bind(this));
|
||||||
console.log('Failed to initialize IndexedDB, local browser saves will be unavailable.');
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.PiskelDatabase.prototype.onUpgradeNeeded_ = function (event) {
|
ns.PiskelDatabase.prototype.onUpgradeNeeded_ = function (event) {
|
||||||
|
@ -7,7 +7,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.IndexedDbStorageService.prototype.init = function () {
|
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) {
|
ns.IndexedDbStorageService.prototype.save = function (piskel) {
|
||||||
@ -30,7 +32,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.IndexedDbStorageService.prototype.load = function (name) {
|
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') {
|
if (typeof piskelData !== 'undefined') {
|
||||||
var serialized = piskelData.serialized;
|
var serialized = piskelData.serialized;
|
||||||
pskl.utils.serialization.Deserializer.deserialize(
|
pskl.utils.serialization.Deserializer.deserialize(
|
||||||
@ -46,7 +48,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.IndexedDbStorageService.prototype.remove = function (name) {
|
ns.IndexedDbStorageService.prototype.remove = function (name) {
|
||||||
this.piskelDatabase.delete(name);
|
return this.piskelDatabase.delete(name);
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.IndexedDbStorageService.prototype.getKeys = function () {
|
ns.IndexedDbStorageService.prototype.getKeys = function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user