Update JS code structure

This commit is contained in:
Patrick Jentsch
2024-12-02 09:34:17 +01:00
parent a2904caea2
commit 12a3ac1d5d
21 changed files with 295 additions and 242 deletions

View File

@ -6,13 +6,13 @@ nopaque.resource_displays.ResourceDisplay = class ResourceDisplay {
this.userId = this.displayElement.dataset.userId;
this.isInitialized = false;
if (this.userId) {
app.subscribeUser(this.userId)
app.users.subscribe(this.userId)
.then((response) => {
app.socket.on('patch_user', (patch) => {
app.socket.on('users.patch', (patch) => {
if (this.isInitialized) {this.onPatch(patch);}
});
});
app.getUser(this.userId)
app.users.get(this.userId)
.then((user) => {
this.init(user);
this.isInitialized = true;