|
|
|
@ -239,9 +239,9 @@ export default () => { |
|
|
|
* }); |
|
|
|
* */ |
|
|
|
load(keys, clb) { |
|
|
|
var st = this.get(this.getCurrent()); |
|
|
|
var keysF = []; |
|
|
|
var result = {}; |
|
|
|
const st = this.get(this.getCurrent()); |
|
|
|
const keysF = []; |
|
|
|
let result = {}; |
|
|
|
|
|
|
|
if (typeof keys === 'string') keys = [keys]; |
|
|
|
this.onStart('load', keys); |
|
|
|
@ -254,13 +254,7 @@ export default () => { |
|
|
|
st.load( |
|
|
|
keysF, |
|
|
|
res => { |
|
|
|
// Restore keys name
|
|
|
|
var reg = new RegExp('^' + c.id + ''); |
|
|
|
for (var itemKey in res) { |
|
|
|
var itemKeyR = itemKey.replace(reg, ''); |
|
|
|
result[itemKeyR] = res[itemKey]; |
|
|
|
} |
|
|
|
|
|
|
|
result = this.__clearKeys(res); |
|
|
|
this.onAfter('load', result); |
|
|
|
clb && clb(result); |
|
|
|
this.onEnd('load', result); |
|
|
|
@ -275,6 +269,24 @@ export default () => { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* Restore key names |
|
|
|
* @param {Object} data |
|
|
|
* @returns {Object} |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
__clearKeys(data = {}) { |
|
|
|
const result = {}; |
|
|
|
const reg = new RegExp('^' + c.id + ''); |
|
|
|
|
|
|
|
for (let itemKey in data) { |
|
|
|
const itemKeyR = itemKey.replace(reg, ''); |
|
|
|
result[itemKeyR] = data[itemKey]; |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* Load default storages |
|
|
|
* @return {this} |
|
|
|
|