Skip to content

Commit 3a0e3f6

Browse files
authored
adjust filename + throttle (#12)
1 parent a8f85a4 commit 3a0e3f6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/index.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,26 @@ return xstring;
129129

130130
var file = document.createElement('a');
131131
file.setAttribute('href', 'data:application/octet-stream;base64,' + Buffer.from(res.get(), "hex").toString("base64"));
132-
file.setAttribute('download', "foo.xlsx");
132+
file.setAttribute('download', "abap2xlsx " + new Date().toISOString() + ".xlsx");
133133
file.innerText = "Download, " + (res.get().length / 2) + " bytes";
134134
document.getElementById("container2").appendChild(file);
135135
}
136136

137+
let tid = 0;
137138
async function abapChanged() {
139+
clearTimeout(tid);
140+
tid = setTimeout(async () => updateEverything(), 800);
141+
}
142+
143+
async function updateEverything() {
138144
// @ts-ignore
139145
console.dir(globalThis.abap);
140146
const contents = editor1.getValue();
141147

148+
const file = new abaplint.MemoryFile(filename, contents);
149+
reg.updateFile(file);
150+
142151
try {
143-
const file = new abaplint.MemoryFile(filename, contents);
144-
reg.updateFile(file);
145152
reg.parse();
146153
abapMonaco.updateMarkers(reg, model1);
147154

0 commit comments

Comments
 (0)