From 04edf4103f1f78463b96551f01f1e191339d98da Mon Sep 17 00:00:00 2001 From: Jaiwanth Date: Fri, 30 Jul 2021 11:46:55 +0530 Subject: [PATCH] Remove unnecessary awaits --- src/utils/exportUtils/Exporter.ts | 4 ++-- src/utils/exportUtils/JSONExport.ts | 2 +- src/utils/exportUtils/PlainTextExport.ts | 2 +- test/utils/export-test.ts | 15 +++++++++++++++ 4 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 test/utils/export-test.ts diff --git a/src/utils/exportUtils/Exporter.ts b/src/utils/exportUtils/Exporter.ts index fd0f603cb5..b521b77aaa 100644 --- a/src/utils/exportUtils/Exporter.ts +++ b/src/utils/exportUtils/Exporter.ts @@ -92,8 +92,8 @@ export default abstract class Exporter { this.cancelled = true; } - protected async downloadPlainText(fileName: string, text: string): Promise { - await saveAs(new Blob[text], fileName); + protected downloadPlainText(fileName: string, text: string) { + saveAs(new Blob[text], fileName); } protected setEventMetadata(event: MatrixEvent): MatrixEvent { diff --git a/src/utils/exportUtils/JSONExport.ts b/src/utils/exportUtils/JSONExport.ts index 3a9b923b08..356f4282db 100644 --- a/src/utils/exportUtils/JSONExport.ts +++ b/src/utils/exportUtils/JSONExport.ts @@ -107,7 +107,7 @@ export default class JSONExporter extends Exporter { await this.downloadZIP(); } else { const fileName = `matrix-export-${formatFullDateNoDay(new Date())}.json`; - await this.downloadPlainText(fileName, text); + this.downloadPlainText(fileName, text); } const exportEnd = performance.now(); diff --git a/src/utils/exportUtils/PlainTextExport.ts b/src/utils/exportUtils/PlainTextExport.ts index 4f00a3aa06..1c946bb048 100644 --- a/src/utils/exportUtils/PlainTextExport.ts +++ b/src/utils/exportUtils/PlainTextExport.ts @@ -134,7 +134,7 @@ export default class PlainTextExporter extends Exporter { await this.downloadZIP(); } else { const fileName = `matrix-export-${formatFullDateNoDay(new Date())}.txt`; - await this.downloadPlainText(fileName, text); + this.downloadPlainText(fileName, text); } const exportEnd = performance.now(); diff --git a/test/utils/export-test.ts b/test/utils/export-test.ts new file mode 100644 index 0000000000..42c4e33b5b --- /dev/null +++ b/test/utils/export-test.ts @@ -0,0 +1,15 @@ +/* +Copyright 2021 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/