Skip to content

Commit

Permalink
Add types
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Oct 23, 2023
1 parent 12bd9af commit f65714f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/assets/javascripts/tutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { html } from "lit";
import { TraceGenerator } from "@dodona/pyodide-trace-library";

export function initTutor(submissionCode: string): void {
let generator;
let generatorReady;
let traceGenerator: TraceGenerator;
let traceGeneratorReady: Promise<void>;
function init(): void {
initTutorLinks();
if (document.querySelectorAll(".tutormodal").length == 1) {
Expand All @@ -21,9 +21,9 @@ export function initTutor(submissionCode: string): void {
function initTutorLinks(): void {
const links = document.querySelectorAll(".tutorlink");
if (links.length > 0) {
// only setup the generator if there are links, as it is a heavy operation
generator = new TraceGenerator();
generatorReady = generator.setup();
// only setup the traceGenerator if there are links, as it is a heavy operation
traceGenerator = new TraceGenerator();
traceGeneratorReady = traceGenerator.setup();
}

links.forEach(l => {
Expand Down Expand Up @@ -126,8 +126,8 @@ export function initTutor(submissionCode: string): void {
</div>`;
}

generatorReady.then(() => {
generator.generateTrace(sourceCode, stdin, inlineFiles, hrefFilesFull).then((result: string) => createTutor(result));
traceGeneratorReady.then(() => {
traceGenerator.generateTrace(sourceCode, stdin, inlineFiles, hrefFilesFull).then((result: string) => createTutor(result));
});
}

Expand Down

0 comments on commit f65714f

Please sign in to comment.