Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 4fb1012

Browse files
committed
async cleanups
1 parent 1e57f41 commit 4fb1012

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

runestone/activecode/js/activecode.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ export class ActiveCode extends RunestoneBase {
551551
// add an initial load history button
552552
// if there is no edit then there is no append to_save (True/False)
553553
async addHistoryScrubber(pos_last) {
554-
let deferred = Promise.resolve();
554+
let response;
555555
var reqData = {
556556
acid: this.divid,
557557
};
@@ -572,7 +572,7 @@ export class ActiveCode extends RunestoneBase {
572572
body: JSON.stringify(reqData),
573573
});
574574
try {
575-
let response = await fetch(request);
575+
response = await fetch(request);
576576
let data = await response.json();
577577
if (data.history !== undefined) {
578578
this.history = this.history.concat(data.history);
@@ -585,16 +585,9 @@ export class ActiveCode extends RunestoneBase {
585585
} catch (e) {
586586
console.log("unable to fetch history");
587587
}
588-
deferred = new Promise((resolve, reject) => {
589-
try {
590-
this.renderScrubber(pos_last);
591-
resolve("done");
592-
} catch (e) {
593-
reject(e);
594-
}
595-
});
588+
this.renderScrubber(pos_last);
596589
}
597-
return deferred;
590+
return "success";
598591
}
599592

600593
renderScrubber(pos_last) {
@@ -1142,10 +1135,7 @@ Yet another is that there is an internal error. The internal error message is:
11421135

11431136
async manage_scrubber(saveCode) {
11441137
if (this.historyScrubber === null && !this.autorun) {
1145-
let response = await this.addHistoryScrubber();
1146-
if (!response.ok) {
1147-
console.log("Failed to load history -- this should not fail.");
1148-
}
1138+
await this.addHistoryScrubber();
11491139
}
11501140
if (
11511141
this.historyScrubber &&

0 commit comments

Comments
 (0)