Skip to content

Commit 7383031

Browse files
Hahihulamaxmcd
authored andcommitted
fixed 'decode is not defined' error
1 parent 3c9ab27 commit 7383031

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

web-client/src/app.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ if (!WebAssembly.instantiateStreaming) {
2121
};
2222
}
2323

24+
function waitForDecode() {
25+
if(typeof decode !== "undefined"){
26+
startSession(urlData);
27+
} else {
28+
setTimeout(waitForDecode, 250);
29+
}
30+
}
31+
2432
const go = new Go();
2533
WebAssembly.instantiateStreaming(fetch("main.wasm"), go.importObject).then(
2634
result => {
@@ -136,7 +144,7 @@ const urlData = window.location.hash.substr(1);
136144
console.log(urlData);
137145
if (urlData != "") {
138146
try {
139-
startSession(urlData);
147+
waitForDecode();
140148
firstInput = true;
141149
} catch (err) {
142150
console.log(err);

0 commit comments

Comments
 (0)