Skip to content
Snippets Groups Projects
Commit 58d409ec authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Port to EventBus

parent ff698664
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ import {createI18nInstance} from './i18n.js'; ...@@ -2,7 +2,7 @@ import {createI18nInstance} from './i18n.js';
import {html, css, LitElement} from 'lit-element'; import {html, css, LitElement} from 'lit-element';
import {ScopedElementsMixin} from '@open-wc/scoped-elements'; import {ScopedElementsMixin} from '@open-wc/scoped-elements';
import {LanguageSelect} from 'vpu-language-select'; import {LanguageSelect} from 'vpu-language-select';
import {Icon} from 'vpu-common'; import {Icon, EventBus} from 'vpu-common';
import {Auth} from 'vpu-auth'; import {Auth} from 'vpu-auth';
import {Notification} from 'vpu-notification'; import {Notification} from 'vpu-notification';
import * as commonStyles from 'vpu-common/styles'; import * as commonStyles from 'vpu-common/styles';
...@@ -10,7 +10,6 @@ import * as commonUtils from 'vpu-common/utils'; ...@@ -10,7 +10,6 @@ import * as commonUtils from 'vpu-common/utils';
import buildinfo from 'consts:buildinfo'; import buildinfo from 'consts:buildinfo';
import {classMap} from 'lit-html/directives/class-map.js'; import {classMap} from 'lit-html/directives/class-map.js';
import {Router} from './router.js'; import {Router} from './router.js';
import * as events from 'vpu-common/events.js';
import {BuildInfo} from './build-info.js'; import {BuildInfo} from './build-info.js';
import {TUGrazLogo} from './tugraz-logo.js'; import {TUGrazLogo} from './tugraz-logo.js';
import {send as notify} from 'vpu-common/notification'; import {send as notify} from 'vpu-common/notification';
...@@ -57,7 +56,6 @@ export class AppShell extends ScopedElementsMixin(LitElement) { ...@@ -57,7 +56,6 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
this._updateAuth = this._updateAuth.bind(this); this._updateAuth = this._updateAuth.bind(this);
this._loginStatus = 'unknown'; this._loginStatus = 'unknown';
this._subscriber = new events.EventSubscriber('vpu-auth-update', 'vpu-auth-update-request');
this._attrObserver = new MutationObserver(this.onAttributeObserved); this._attrObserver = new MutationObserver(this.onAttributeObserved);
} }
...@@ -241,15 +239,17 @@ export class AppShell extends ScopedElementsMixin(LitElement) { ...@@ -241,15 +239,17 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
connectedCallback() { connectedCallback() {
super.connectedCallback(); super.connectedCallback();
this._bus = new EventBus();
if (this.src) if (this.src)
this.fetchMetadata(this.src); this.fetchMetadata(this.src);
this.initRouter(); this.initRouter();
this._subscriber.subscribe(this._updateAuth); this._bus.subscribe('auth-update', this._updateAuth);
} }
disconnectedCallback() { disconnectedCallback() {
this._subscriber.unsubscribe(this._updateAuth); this._bus.close();
super.disconnectedCallback(); super.disconnectedCallback();
} }
......
auth @ 4594a220
Subproject commit f3aa17bcca0c04055ad2835ed620146a741a107d Subproject commit 4594a22095b2a7a06c0f91ec0a51a0a55125b356
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment