src/aria/templates/ModuleCtrlFactory.js
function (moduleCtrlPrivate) {
                var k = moduleCtrlPrivate[MODULECTRL_ID_PROPERTY];
                var res = getModulePrivateInfoWithCheck(moduleCtrlPrivate, "notifyModuleCtrlDisposed");
                if (!res) {
                    // error is already logged
                    return;
                }
                res.isDisposing = true;
                var subModuleInfos = res.subModuleInfos;
                var parentModule = subModuleInfos ? subModuleInfos.parentModule : null;
                if (parentModule && !parentModule.isDisposing) {
                    // This module is a sub-module and its parent module is not being disposed

                    // remove the module from parent array of sub-modules
                    ariaUtilsArray.remove(parentModule.subModules, moduleCtrlPrivate);
                    // remove module controller from refpath:
                    putSubModuleAtRefPath.call(this, parentModule, subModuleInfos.subModuleDesc, null, subModuleInfos.customModule);
                }
                // dispose sub-modules (including custom modules):
                var subModules = res.subModules;
                if (subModules) {
                    for (var i = subModules.length - 1; i >= 0; i--) {
                        try {
                            subModules[i].$dispose();
                        } catch (ex) {
                            // an error when disposing a sub-module must never prevent the parent module to be disposed
                            // (especially if the child module is a custom module)
                            this.$logError(this.EXCEPTION_SUBMODULE_DISPOSE, [moduleCtrlPrivate.$classpath,
                                    subModules[i].$classpath], ex);
                        }
                    }
                    res.subModules = null;
                }
                modulesPrivateInfo[k] = null;
                delete modulesPrivateInfo[k];
                if (res.flowCtrlPrivate) {
                    res.flowCtrlPrivate.$dispose();
                    res.flowCtrlPrivate = null;
                    res.flowCtrl = null;
                }
                res.moduleCtrl = null;
                res.moduleCtrlPrivate = null;
                res.subModuleInfos = null;
            }
function (moduleCtrlPrivate) {
                var k = moduleCtrlPrivate[MODULECTRL_ID_PROPERTY];
                var res = getModulePrivateInfoWithCheck(moduleCtrlPrivate, "notifyModuleCtrlDisposed");
                if (!res) {
                    // error is already logged
                    return;
                }
                res.isDisposing = true;
                var subModuleInfos = res.subModuleInfos;
                var parentModule = subModuleInfos ? subModuleInfos.parentModule : null;
                if (parentModule && !parentModule.isDisposing) {
                    // This module is a sub-module and its parent module is not being disposed

                    // remove the module from parent array of sub-modules
                    ariaUtilsArray.remove(parentModule.subModules, moduleCtrlPrivate);
                    // remove module controller from refpath:
                    putSubModuleAtRefPath.call(this, parentModule, subModuleInfos.subModuleDesc, null, subModuleInfos.customModule);
                }
                // dispose sub-modules (including custom modules):
                var subModules = res.subModules;
                if (subModules) {
                    for (var i = subModules.length - 1; i >= 0; i--) {
                        try {
                            subModules[i].$dispose();
                        } catch (ex) {
                            // an error when disposing a sub-module must never prevent the parent module to be disposed
                            // (especially if the child module is a custom module)
                            this.$logError(this.EXCEPTION_SUBMODULE_DISPOSE, [moduleCtrlPrivate.$classpath,
                                    subModules[i].$classpath], ex);
                        }
                    }
                    res.subModules = null;
                }
                modulesPrivateInfo[k] = null;
                delete modulesPrivateInfo[k];
                if (res.flowCtrlPrivate) {
                    res.flowCtrlPrivate.$dispose();
                    res.flowCtrlPrivate = null;
                    res.flowCtrl = null;
                }
                res.moduleCtrl = null;
                res.moduleCtrlPrivate = null;
                res.subModuleInfos = null;
            }
function ( moduleCtrlPrivate ) { var k = moduleCtrlPrivate [ MODULECTRL_ID_PROPERTY ] ; var res = getModulePrivateInfoWithCheck ( moduleCtrlPrivate , "notifyModuleCtrlDisposed" ) ; if ( ! res ) { // error is already logged return ; } res . isDisposing = true ; var subModuleInfos = res . subModuleInfos ; var parentModule = subModuleInfos ? subModuleInfos . parentModule : null ; if ( parentModule && ! parentModule . isDisposing ) { // This module is a sub-module and its parent module is not being disposed // remove the module from parent array of sub-modules ariaUtilsArray . remove ( parentModule . subModules , moduleCtrlPrivate ) ; // remove module controller from refpath: putSubModuleAtRefPath . call ( this , parentModule , subModuleInfos . subModuleDesc , null , subModuleInfos . customModule ) ; } // dispose sub-modules (including custom modules): var subModules = res . subModules ; if ( subModules ) { for ( var i = subModules . length - 1 ; i >= 0 ; i -- ) { try { subModules [ i ] . $dispose ( ) ; } catch ( ex ) { // an error when disposing a sub-module must never prevent the parent module to be disposed // (especially if the child module is a custom module) this . $logError ( this . EXCEPTION_SUBMODULE_DISPOSE , [ moduleCtrlPrivate . $classpath , subModules [ i ] . $classpath ] , ex ) ; } } res . subModules = null ; } modulesPrivateInfo [ k ] = null ; delete modulesPrivateInfo [ k ] ; if ( res . flowCtrlPrivate ) { res . flowCtrlPrivate . $dispose ( ) ; res . flowCtrlPrivate = null ; res . flowCtrl = null ; } res . moduleCtrl = null ; res . moduleCtrlPrivate = null ; res . subModuleInfos = null ; }
This method should only be called from aria.templates.ModuleCtrl when a module controller is disposed, so
that its sub-modules and flow can be disposed as well.
@param {aria.templates.ModuleCtrl} moduleCtrlPrivate module controller instance which is being disposed
@private
This method should only be called from aria . templates . ModuleCtrl when a module controller is disposed so that its sub - modules and flow can be disposed as well .