Browse Source

Add open and close methods to AssetManager

pull/3795/head
Artur Arseniev 5 years ago
parent
commit
0cdda7abc7
  1. 23
      src/asset_manager/index.js

23
src/asset_manager/index.js

@ -81,11 +81,6 @@ export default () => {
removeBefore: evRemoveBefore
},
/**
* Initialize module
* @param {Object} config Configurations
* @private
*/
init(config = {}) {
c = { ...defaults, ...config };
const ppfx = c.pStylePrefix;
@ -115,6 +110,24 @@ export default () => {
this.getAll().trigger(ev, ...data);
},
/**
* Open the asset manager.
* @param {Object} [options] Options for the asset manager.
* @param {Array<String} [options.types=['image']] Types of assets to show.
*/
open(options = {}) {
const cmd = this.em.get('Commands');
cmd.run('open-assets', options);
},
/**
* Close the asset manager.
*/
close() {
const cmd = this.em.get('Commands');
cmd.stop('open-assets');
},
/**
* Add new asset/s to the collection. URLs are supposed to be unique
* @param {String|Object|Array<String>|Array<Object>} asset URL strings or an objects representing the resource.

Loading…
Cancel
Save