|
|
|
@ -50,18 +50,9 @@ module.exports = class IndexDbController extends EventEmitter { |
|
|
|
|
get (key) { |
|
|
|
|
return this.requestObjectStore(key) |
|
|
|
|
.then((dataObject)=> { |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
const getRequest = dataObject.get(key) |
|
|
|
|
getRequest.onsuccess = (event) => { |
|
|
|
|
const serialized = event.currentTarget.result |
|
|
|
|
try { |
|
|
|
|
console.log('serialized:',serialized) |
|
|
|
|
const state = serialized ? JSON.parse(serialized) : {} |
|
|
|
|
resolve(state) |
|
|
|
|
} catch (err) { |
|
|
|
|
reject(err) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
getRequest.onsuccess = (event) => resolve(event.currentTarget.result) |
|
|
|
|
getRequest.onerror = (event) => reject(event) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|