1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-04 05:02:41 +03:00

Merge pull request #1945 from matrix-org/gsouquet/thread-serialise-18720

This commit is contained in:
Germain
2021-09-24 11:17:39 +01:00
committed by GitHub

View File

@@ -26,6 +26,11 @@ export enum ThreadEvent {
Update = "Thread.update" Update = "Thread.update"
} }
interface ISerialisedThread {
id: string;
tails: string[];
}
/** /**
* @experimental * @experimental
*/ */
@@ -206,6 +211,13 @@ export class Thread extends EventEmitter {
return this.timelineSet.findEventById(eventId) instanceof MatrixEvent; 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 { public on(event: ThreadEvent, listener: (...args: any[]) => void): this {
super.on(event, listener); super.on(event, listener);
return this; return this;