Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  /**
  2.    * Loads components/directives modules for given extension point. Once all the component modules are loaded, their
  3.    * plugin definitions are returned mapped by concrete property from their definition.
  4.    *
  5.    * @param extensionPoint
  6.    * @param mapBy The key to be used for their mapping in the result map. This key should be an existing property from
  7.    *          plugin definitions for that extension point.
  8.    * @returns {Promise.<T>|Promise} A map that contains plugin definitions for loaded modules mapped by provided key.
  9.    */
  10.   loadComponentModules(extensionPoint, mapBy, filterFunc) {
  11.     var promises = [];
  12.     let definitions = this.getPluginDefinitions(extensionPoint, mapBy);
  13.     if (_.isFunction(filterFunc)) {
  14.       console.log('definitions: ' + definitions);
  15.       definitions = filterBy(definitions, filterFunc);
  16.     }
  17.     Object.keys(definitions).forEach((definition) => {
  18.       promises.push(this.executeImport(definitions[definition].module));
  19.     });
  20.     return this.promiseAdapter.all(promises).then(() => {
  21.       return definitions;
  22.     });
  23.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement