diff --git a/platform/framework/src/Bundle.js b/platform/framework/src/Bundle.js index 2372f17ac0..e2ab0a719e 100644 --- a/platform/framework/src/Bundle.js +++ b/platform/framework/src/Bundle.js @@ -95,6 +95,9 @@ define( return new Extension(self, category, extDefinition); }); }, + getExtensionCategories: function () { + return Object.keys(definition.extensions); + }, /** * * @memberof Bundle# diff --git a/platform/framework/src/Extension.js b/platform/framework/src/Extension.js index 358884550f..c71904e800 100644 --- a/platform/framework/src/Extension.js +++ b/platform/framework/src/Extension.js @@ -48,6 +48,13 @@ define( getCategory: function () { return category; }, + /** + * Check whether or not this + * @returns {boolean} + */ + hasImplementation: function () { + return definition.implementation !== undefined; + }, /** * Get the path to the AMD module which implements this * extension. Will return undefined if there is no diff --git a/platform/framework/src/ExtensionResolver.js b/platform/framework/src/ExtensionResolver.js new file mode 100644 index 0000000000..57f8dc0d2f --- /dev/null +++ b/platform/framework/src/ExtensionResolver.js @@ -0,0 +1,23 @@ +/*global define,Promise*/ + +/** + * Module defining ExtensionResolver. Created by vwoeltje on 11/3/14. + */ +define( + [], + function () { + "use strict"; + + /** + * + * @constructor + */ + function ExtensionResolver(require) { + return { + + }; + } + + return ExtensionResolver; + } +); \ No newline at end of file diff --git a/platform/framework/src/ImplementationLoader.js b/platform/framework/src/ImplementationLoader.js new file mode 100644 index 0000000000..6d864fb054 --- /dev/null +++ b/platform/framework/src/ImplementationLoader.js @@ -0,0 +1,46 @@ +/*global define,Promise*/ + +/** + * Module defining ImplementationLoader. Created by vwoeltje on 11/3/14. + */ +define( + [], + function () { + "use strict"; + + /** + * Responsible for loading extension implementations + * (AMD modules.) Acts as a wrapper around RequireJS to + * provide a promise-like API. + * @constructor + * @param {*} require RequireJS, or an object with similar API + * @param {*} $log Angular's logging service + */ + function ImplementationLoader(require) { + function loadModule(path) { + return new Promise(function (fulfill, reject) { + require(path, fulfill, reject); + }); + } + + return { + /** + * Load an extension's implementation; or, equivalently, + * load an AMD module. This is fundamentally similar + * to a call to RequireJS, except that the result is + * wrapped in a promise. The promise will be fulfilled + * with the loaded module, or rejected with the error + * reported by Require. + * + * @method + * @memberof ImplementationLoader# + * @param {string} path the path to the module to load + * @returns {Promise} a promise for the specified module. + */ + load: loadModule + }; + } + + return ImplementationLoader; + } +); \ No newline at end of file