forked from mystiq/hydrogen-web
clear unread state 2s after opening the room
This commit is contained in:
parent
89392434ad
commit
dbf5e59d87
1 changed files with 14 additions and 0 deletions
|
@ -32,6 +32,7 @@ export class RoomViewModel extends ViewModel {
|
||||||
this._sendError = null;
|
this._sendError = null;
|
||||||
this._closeCallback = closeCallback;
|
this._closeCallback = closeCallback;
|
||||||
this._composerVM = new ComposerViewModel(this);
|
this._composerVM = new ComposerViewModel(this);
|
||||||
|
this._clearUnreadTimout = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
|
@ -49,6 +50,15 @@ export class RoomViewModel extends ViewModel {
|
||||||
this._timelineError = err;
|
this._timelineError = err;
|
||||||
this.emitChange("error");
|
this.emitChange("error");
|
||||||
}
|
}
|
||||||
|
this._clearUnreadTimout = this.clock.createTimeout(2000);
|
||||||
|
try {
|
||||||
|
await this._clearUnreadTimout.elapsed();
|
||||||
|
await this._room.clearUnread();
|
||||||
|
} catch (err) {
|
||||||
|
if (err.name !== "AbortError") {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
|
@ -57,6 +67,10 @@ export class RoomViewModel extends ViewModel {
|
||||||
// will stop the timeline from delivering updates on entries
|
// will stop the timeline from delivering updates on entries
|
||||||
this._timeline.close();
|
this._timeline.close();
|
||||||
}
|
}
|
||||||
|
if (this._clearUnreadTimout) {
|
||||||
|
this._clearUnreadTimout.abort();
|
||||||
|
this._clearUnreadTimout = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
|
|
Loading…
Reference in a new issue