|
|
@ -202,30 +202,23 @@ module.exports = () => { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Load data from the passed object, if the object is empty will try to fetch them |
|
|
* Load data from the passed object. |
|
|
* autonomously from the storage manager. |
|
|
* The fetched data will be added to the collection. |
|
|
* The fetched data will be added to the collection |
|
|
|
|
|
* @param {Object} data Object of data to load |
|
|
* @param {Object} data Object of data to load |
|
|
* @return {Object} Loaded assets |
|
|
* @return {Object} Loaded assets |
|
|
* @example |
|
|
* @example |
|
|
* var assets = assetManager.load(); |
|
|
|
|
|
* // The format below will be used by the editor model
|
|
|
|
|
|
* // to load automatically all the stuff
|
|
|
|
|
|
* var assets = assetManager.load({ |
|
|
* var assets = assetManager.load({ |
|
|
* assets: [...] |
|
|
* assets: [...] |
|
|
* }) |
|
|
* }) |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
load(data) { |
|
|
load(data = {}) { |
|
|
var d = data || ''; |
|
|
const name = this.storageKey; |
|
|
var name = this.storageKey; |
|
|
let assets = data[name] || []; |
|
|
if(!d && c.stm) |
|
|
|
|
|
d = c.stm.load(name); |
|
|
|
|
|
var assets = d[name] || []; |
|
|
|
|
|
|
|
|
|
|
|
if (typeof assets == 'string') { |
|
|
if (typeof assets == 'string') { |
|
|
try { |
|
|
try { |
|
|
assets = JSON.parse(d[name]); |
|
|
assets = JSON.parse(data[name]); |
|
|
} catch(err) {} |
|
|
} catch(err) {} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|