Skip to content

Commit 3bd1b46

Browse files
github
1 parent 1f28571 commit 3bd1b46

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/script.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,15 @@ term.onData(data => {
204204

205205
async function init() {
206206
// Initialize terminal
207-
//print ./assets/miao.txt
208-
await fetch('./assets/miao.txt')
209-
.then(response => response.text())
207+
//print /assets/miao.txt
208+
await fetch('/assets/miao.txt')
209+
.then(response => {
210+
if (response.status === 200) {
211+
return response.text();
212+
} else {
213+
throw new Error('HTTP ' + response.status);
214+
}
215+
})
210216
.then(text => {
211217
text.split(/\r?\n/).forEach(line => term.writeln(line));
212218
})

0 commit comments

Comments
 (0)