Apply prettier formatting

This commit is contained in:
Michael Weimann
2022-12-09 13:28:29 +01:00
parent a32f12c8f3
commit 7921a6cbf8
104 changed files with 12169 additions and 11047 deletions

View File

@@ -24,7 +24,7 @@ import { parseQsFromFragment } from "./url_utils";
let lastLocationHashSet: string = null;
export function getScreenFromLocation(location: Location): { screen: string, params: QueryDict } {
export function getScreenFromLocation(location: Location): { screen: string; params: QueryDict } {
const fragparts = parseQsFromFragment(location);
return {
screen: fragparts.location.substring(1),
@@ -54,11 +54,12 @@ function onHashChange(): void {
// so a web page can update the URL bar appropriately.
export function onNewScreen(screen: string, replaceLast = false): void {
logger.log("newscreen " + screen);
const hash = '#/' + screen;
const hash = "#/" + screen;
lastLocationHashSet = hash;
// if the new hash is a substring of the old one then we are stripping fields e.g `via` so replace history
if (screen.startsWith("room/") &&
if (
screen.startsWith("room/") &&
window.location.hash.includes("/$") === hash.includes("/$") && // only if both did or didn't contain event link
window.location.hash.startsWith(hash)
) {
@@ -73,5 +74,5 @@ export function onNewScreen(screen: string, replaceLast = false): void {
}
export function init(): void {
window.addEventListener('hashchange', onHashChange);
window.addEventListener("hashchange", onHashChange);
}