From c7b2339c880dc7294261b679df8d327d3af93c2b Mon Sep 17 00:00:00 2001 From: Lars Hvam Date: Mon, 9 Sep 2024 10:56:34 +0200 Subject: [PATCH 1/2] adjust filename --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 3b597c9..ee166ec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -129,7 +129,7 @@ return xstring; var file = document.createElement('a'); file.setAttribute('href', 'data:application/octet-stream;base64,' + Buffer.from(res.get(), "hex").toString("base64")); - file.setAttribute('download', "foo.xlsx"); + file.setAttribute('download', "abap2xlsx " + new Date().toISOString() + ".xlsx"); file.innerText = "Download, " + (res.get().length / 2) + " bytes"; document.getElementById("container2").appendChild(file); } From 391be3819a32ae873243d1e2c09b0ab965962554 Mon Sep 17 00:00:00 2001 From: Lars Hvam Date: Mon, 9 Sep 2024 11:02:08 +0200 Subject: [PATCH 2/2] throttle --- src/index.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index ee166ec..c4b27a7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -134,14 +134,21 @@ return xstring; document.getElementById("container2").appendChild(file); } +let tid = 0; async function abapChanged() { + clearTimeout(tid); + tid = setTimeout(async () => updateEverything(), 800); +} + +async function updateEverything() { // @ts-ignore console.dir(globalThis.abap); const contents = editor1.getValue(); + const file = new abaplint.MemoryFile(filename, contents); + reg.updateFile(file); + try { - const file = new abaplint.MemoryFile(filename, contents); - reg.updateFile(file); reg.parse(); abapMonaco.updateMarkers(reg, model1);