user-area.js 508 B

1234567891011121314151617181920
  1. const app = require('../app')
  2. app.component('appUserArea', {
  3. transclude: true,
  4. bindings: {
  5. titleText: '@'
  6. },
  7. template: html`<div ng-transclude></div>`,
  8. controller: function($scope, $rootScope) {
  9. $rootScope.inUserArea = ($rootScope.inUserArea || 0) + 1
  10. $rootScope.userArea = this
  11. $scope.$on('$destroy', () => {
  12. setTimeout(() => {
  13. $rootScope.inUserArea--
  14. if ($rootScope.userArea === this) {
  15. $rootScope.userArea = null
  16. }
  17. })
  18. })
  19. }
  20. })