From 25b8bc4780ffbc1be10fb8f3835b3426f469c36b Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 1 Feb 2023 14:31:18 +0100 Subject: [PATCH] format --- .../router-slot/router-slot.element.ts | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/router-slot/router-slot.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/router-slot/router-slot.element.ts index 4bc829b05b..bc30cbf18d 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/router-slot/router-slot.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/router-slot/router-slot.element.ts @@ -1,8 +1,8 @@ import { LitElement, PropertyValueMap } from 'lit'; import { customElement, property } from 'lit/decorators.js'; import { IRoute, RouterSlot } from 'router-slot'; -import { UmbRouterSlotChangeEvent } from './routet-slot-change.event'; -import { UmbRouterSlotInitEvent } from './routet-slot-init.event'; +import { UmbRouterSlotChangeEvent } from './router-slot-change.event'; +import { UmbRouterSlotInitEvent } from './router-slot-init.event'; /** * @element umb-router-slot-element @@ -11,12 +11,9 @@ import { UmbRouterSlotInitEvent } from './routet-slot-init.event'; */ @customElement('umb-router-slot') export class UmbRouterSlotElement extends LitElement { - - #router: RouterSlot; #listening = false; - @property() public get routes(): IRoute[] | undefined { return (this.#router as any).routes; @@ -25,24 +22,20 @@ export class UmbRouterSlotElement extends LitElement { (this.#router as any).routes = value; } - private _routerPath?: string; public get absoluteRouterPath() { return this._routerPath; } - private _activeLocalPath?: string; public get localActiveViewPath() { return this._activeLocalPath; } - public get absoluteActiveViewPath() { - return this._routerPath+'/'+this._activeLocalPath; + return this._routerPath + '/' + this._activeLocalPath; } - constructor() { super(); this.#router = document.createElement('router-slot'); @@ -50,15 +43,15 @@ export class UmbRouterSlotElement extends LitElement { connectedCallback() { super.connectedCallback(); - if(this.#listening === false) { - window.addEventListener("navigationsuccess", this._onNavigationChanged); + if (this.#listening === false) { + window.addEventListener('navigationsuccess', this._onNavigationChanged); this.#listening = true; } } disconnectedCallback() { super.disconnectedCallback(); - window.removeEventListener("navigationsuccess", this._onNavigationChanged); + window.removeEventListener('navigationsuccess', this._onNavigationChanged); this.#listening = false; } @@ -69,11 +62,11 @@ export class UmbRouterSlotElement extends LitElement { } private _onNavigationChanged = (event?: any) => { - if(event.detail.slot === this.#router) { + if (event.detail.slot === this.#router) { this._activeLocalPath = event.detail.match.route.path; this.dispatchEvent(new UmbRouterSlotChangeEvent()); } - } + }; render() { return this.#router;