diff --git a/src/models/thread.ts b/src/models/thread.ts index 1428980bc..25941ad5a 100644 --- a/src/models/thread.ts +++ b/src/models/thread.ts @@ -25,6 +25,11 @@ export enum ThreadEvent { Update = "Thread.update" } +interface ISerialisedThread { + id: string; + tails: string[]; +} + /** * @experimental */ @@ -199,6 +204,13 @@ export class Thread extends EventEmitter { return this.timelineSet.findEventById(eventId) instanceof MatrixEvent; } + public toJson(): ISerialisedThread { + return { + id: this.id, + tails: Array.from(this.tail), + }; + } + public on(event: ThreadEvent, listener: (...args: any[]) => void): this { super.on(event, listener); return this;