docs: function (exiting, exitQueue, onExit) {
            var exitingNames = {};
            angular.forEach(exitQueue, function (state) {
              exitingNames[state.self.name] = true;
            });
  
            angular.forEach(inactiveStates, function (inactiveExiting, name) {
              // TODO: Might need to run the inactivations in the proper depth-first order?
              if (!exitingNames[name] && inactiveExiting.includes[exiting.name]) {
                if (DEBUG) $log.debug("Exiting " + name + " because it's a substate of " + exiting.name + " and wasn't found in ", exitingNames);
                if (inactiveExiting.self.onExit)
                  $injector.invoke(inactiveExiting.self.onExit, inactiveExiting.self, inactiveExiting.locals.globals);
                angular.forEach(inactiveExiting.locals, function(localval, key) {
                  delete inactivePseudoState.locals[key];
                });
                inactiveExiting.locals = null;
                inactiveExiting.self.status = 'exited';
                delete inactiveStates[name];
              }
            });
  
            if (onExit)
              $injector.invoke(onExit, exiting.self, exiting.locals.globals);
            exiting.locals = null;
            exiting.self.status = 'exited';
            delete inactiveStates[exiting.self.name];
          }