mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-20 20:46:15 +08:00
added loading to script fetch
This commit is contained in:
parent
b123bde96e
commit
1605cccc8c
1 changed files with 3 additions and 0 deletions
|
@ -7,6 +7,7 @@ import Config, * as UpdateConfig from "../config";
|
|||
import * as TestUI from "../test/test-ui";
|
||||
import * as ConfigEvent from "../observables/config-event";
|
||||
import * as TestState from "../test/test-state";
|
||||
import * as Loader from "../elements/loader";
|
||||
|
||||
let challengeLoading = false;
|
||||
|
||||
|
@ -204,7 +205,9 @@ export async function setup(challengeName: string): Promise<boolean> {
|
|||
UpdateConfig.setMode("custom", true);
|
||||
UpdateConfig.setDifficulty("normal", true);
|
||||
} else if (challenge.type === "script") {
|
||||
Loader.show();
|
||||
const response = await fetch("/challenges/" + challenge.parameters[0]);
|
||||
Loader.hide();
|
||||
const scriptdata = await response.text();
|
||||
let text = scriptdata.trim();
|
||||
text = text.replace(/[\n\r\t ]/gm, " ");
|
||||
|
|
Loading…
Add table
Reference in a new issue