Add an abstract exporter base class

pull/21833/head
Jaiwanth 2021-05-24 20:48:13 +05:30
parent 1ee6e42e27
commit 136b6db047
2 changed files with 10 additions and 7 deletions

View File

@ -0,0 +1,7 @@
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import Room from 'matrix-js-sdk/src/models/room';
export abstract class Exporter {
constructor(protected res: MatrixEvent[], protected room: Room) {}
abstract export(): Promise<void>
}

View File

@ -6,7 +6,7 @@ import { textForEvent } from "../../TextForEvent";
import { Room } from 'matrix-js-sdk/src/models/room';
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { getUserNameColorClass } from "../FormattingUtils";
import { Exporter } from "./Exporter";
const css = `
body {
@ -273,16 +273,12 @@ div.mx_selected {
}
`;
export default class HTMLExporter {
export default class HTMLExporter extends Exporter {
protected zip: JSZip;
protected res: MatrixEvent[];
protected room: Room;
protected avatars: Map<string, boolean>;
constructor(res: MatrixEvent[], room: Room) {
this.res = res;
this.room = room;
super(res, room);
this.zip = new JSZip();
this.avatars = new Map<string, boolean>();
}