From e590ea788aefe0714bb9ce24976303566a648d42 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 9 Sep 2022 12:45:37 +0200 Subject: reworked websocket stuff with encryption and new spec --- client-web/source/user.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'client-web/source/user.ts') diff --git a/client-web/source/user.ts b/client-web/source/user.ts index dbf2862..057cdf4 100644 --- a/client-web/source/user.ts +++ b/client-web/source/user.ts @@ -6,13 +6,12 @@ import { TrackHandle } from "./track_handle.ts"; export abstract class User { - el: HTMLElement - - local = false - + protected el: HTMLElement + public local = false + public name?: string protected tracks: Set = new Set() - constructor(public room: Room, public id: number, public name: string) { + constructor(public room: Room, public id: number,) { this.el = document.createElement("div") this.el.classList.add("user") this.room.el.append(this.el) @@ -34,11 +33,13 @@ export abstract class User { }) } + get display_name() { return this.name ?? `guest (${this.id})` } + setup_view() { const info_el = document.createElement("div") info_el.classList.add("info") const name_el = document.createElement("span") - name_el.textContent = this.name + name_el.textContent = this.display_name name_el.classList.add("name") info_el.append(name_el) this.el.append(info_el) -- cgit v1.2.3-70-g09d2