From 1b228b0200bd6f9d998c811f8a4df897926dd295 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Sat, 1 Jun 2019 18:29:23 +0200 Subject: [PATCH] export timelineviewmodel from roomviewmodel --- src/domain/session/room/RoomViewModel.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/domain/session/room/RoomViewModel.js b/src/domain/session/room/RoomViewModel.js index 2e9c4053..17427305 100644 --- a/src/domain/session/room/RoomViewModel.js +++ b/src/domain/session/room/RoomViewModel.js @@ -1,10 +1,12 @@ import EventEmitter from "../../../EventEmitter.js"; +import TimelineViewModel from "./timeline/TimelineViewModel.js"; export default class RoomViewModel extends EventEmitter { constructor(room) { super(); this._room = room; this._timeline = null; + this._timelineVM = null; this._onRoomChange = this._onRoomChange.bind(this); this._timelineError = null; } @@ -13,6 +15,7 @@ export default class RoomViewModel extends EventEmitter { this._room.on("change", this._onRoomChange); try { this._timeline = await this._room.openTimeline(); + this._timelineVM = new TimelineViewModel(this._timeline); this.emit("change", "timelineEntries"); } catch (err) { this._timelineError = err; @@ -22,6 +25,7 @@ export default class RoomViewModel extends EventEmitter { disable() { if (this._timeline) { + // will stop the timeline from delivering updates on entries this._timeline.close(); } } @@ -36,8 +40,8 @@ export default class RoomViewModel extends EventEmitter { return this._room.name; } - get timelineEntries() { - return this._timeline && this._timeline.entries; + get timelineViewModel() { + return this._timelineVM; } get error() {