From 621c21d26cff47507061e607396123b817bb421d Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Wed, 22 Nov 2023 15:51:44 +0100 Subject: [PATCH] Minor cleanup --- web/syscalls/editor.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/web/syscalls/editor.ts b/web/syscalls/editor.ts index 5e2fdec..ae8c312 100644 --- a/web/syscalls/editor.ts +++ b/web/syscalls/editor.ts @@ -65,7 +65,7 @@ export function editorSyscalls(editor: Client): SysCallMapping { "editor.uploadFile": ( _ctx, accept?: string, - capture?: string + capture?: string, ): Promise => { return new Promise((resolve, reject) => { const input = document.createElement("input"); @@ -82,22 +82,27 @@ export function editorSyscalls(editor: Client): SysCallMapping { if (!file) { reject(new Error("No file found")); } else { - var reader = new FileReader(); + const reader = new FileReader(); reader.readAsArrayBuffer(file); reader.onloadend = async (evt) => { if (evt.target?.readyState == FileReader.DONE) { - const arrayBuffer = evt.target.result; resolve({ name: file.name, - content: new Uint8Array(await file.arrayBuffer()) + content: new Uint8Array(await file.arrayBuffer()), }); } }; - reader.onabort = (e) => { reject(e) }; - reader.onerror = (e) => { reject(e) }; + reader.onabort = (e) => { + reject(e); + }; + reader.onerror = (e) => { + reject(e); + }; } - } - input.onabort = (e) => { reject(e) }; + }; + input.onabort = (e) => { + reject(e); + }; input.click(); });