You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-17 17:42:41 +03:00
Handle export cancellation
This commit is contained in:
@@ -64,6 +64,7 @@ ${json}
|
||||
protected async createOutput(events: MatrixEvent[]) {
|
||||
let content = "";
|
||||
for (const event of events) {
|
||||
if (this.cancelled) return this.cleanUp();
|
||||
if (!haveTileForEvent(event)) continue;
|
||||
content += await this.getJSONString(event);
|
||||
}
|
||||
@@ -93,11 +94,14 @@ ${json}
|
||||
|
||||
const exportEnd = performance.now();
|
||||
|
||||
console.info("Export successful!")
|
||||
console.log(`Exported ${res.length} events in ${(exportEnd - fetchStart)/1000} seconds`);
|
||||
if (this.cancelled) {
|
||||
console.info("Export cancelled successfully");
|
||||
} else {
|
||||
console.info("Export successful!")
|
||||
console.log(`Exported ${res.length} events in ${(exportEnd - fetchStart)/1000} seconds`);
|
||||
}
|
||||
|
||||
window.removeEventListener("beforeunload", this.onBeforeUnload);
|
||||
window.removeEventListener("onunload", this.abortExport);
|
||||
this.cleanUp()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user