src/utils/ExtensionLoader.js
function loadExtension(name, config, entryPoint) {
        var promise = new $.Deferred();

        // Try to load the package.json to figure out if we are loading a theme.
        ExtensionUtils.loadMetadata(config.baseUrl).always(promise.resolve);

        return promise
            .then(function (metadata) {
                // No special handling for themes... Let the promise propagate into the ExtensionManager
                if (metadata && metadata.theme) {
                    return;
                }

                if (!metadata.disabled) {
                    return loadExtensionModule(name, config, entryPoint);
                } else {
                    return new $.Deferred().reject("disabled").promise();
                }
            })
            .then(function () {
                exports.trigger("load", config.baseUrl);
            }, function (err) {
                if (err === "disabled") {
                    exports.trigger("disabled", config.baseUrl);
                } else {
                    exports.trigger("loadFailed", config.baseUrl);
                }
            });
    }
function loadExtension(name, config, entryPoint) {
        var promise = new $.Deferred();

        // Try to load the package.json to figure out if we are loading a theme.
        ExtensionUtils.loadMetadata(config.baseUrl).always(promise.resolve);

        return promise
            .then(function (metadata) {
                // No special handling for themes... Let the promise propagate into the ExtensionManager
                if (metadata && metadata.theme) {
                    return;
                }

                if (!metadata.disabled) {
                    return loadExtensionModule(name, config, entryPoint);
                } else {
                    return new $.Deferred().reject("disabled").promise();
                }
            })
            .then(function () {
                exports.trigger("load", config.baseUrl);
            }, function (err) {
                if (err === "disabled") {
                    exports.trigger("disabled", config.baseUrl);
                } else {
                    exports.trigger("loadFailed", config.baseUrl);
                }
            });
    }
function loadExtension ( name , config , entryPoint ) { var promise = new $ . Deferred ( ) ; // Try to load the package.json to figure out if we are loading a theme. ExtensionUtils . loadMetadata ( config . baseUrl ) . always ( promise . resolve ) ; return promise . then ( function ( metadata ) { // No special handling for themes... Let the promise propagate into the ExtensionManager if ( metadata && metadata . theme ) { return ; } if ( ! metadata . disabled ) { return loadExtensionModule ( name , config , entryPoint ) ; } else { return new $ . Deferred ( ) . reject ( "disabled" ) . promise ( ) ; } } ) . then ( function ( ) { exports . trigger ( "load" , config . baseUrl ) ; } , function ( err ) { if ( err === "disabled" ) { exports . trigger ( "disabled" , config . baseUrl ) ; } else { exports . trigger ( "loadFailed" , config . baseUrl ) ; } } ) ; }
Loads the extension that lives at baseUrl into its own Require.js context

@param {!string} name, used to identify the extension
@param {!{baseUrl: string}} config object with baseUrl property containing absolute path of extension
@param {!string} entryPoint, name of the main js file to load
@return {!$.Promise} A promise object that is resolved when the extension is loaded, or rejected
if the extension fails to load or throws an exception immediately when loaded.
(Note: if extension contains a JS syntax error, promise is resolved not rejected).
Loads the extension that lives at baseUrl into its own Require . js context