const app = require('../app') app.component('appUserArea', { transclude: true, bindings: { titleText: '@' }, template: html`
`, controller: function($scope, $rootScope) { $rootScope.inUserArea = ($rootScope.inUserArea || 0) + 1 $rootScope.userArea = this $scope.$on('$destroy', () => { setTimeout(() => { $rootScope.inUserArea-- if ($rootScope.userArea === this) { $rootScope.userArea = null } }) }) } })