Skip to content

Commit 9254b9a

Browse files
authored
Merge pull request #20 from ekharkunov/issue-19-loading-error
Fix loading error when poki sdk script loads later than all other game stuff
2 parents f166959 + 05ca5ea commit 9254b9a

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

poki-sdk/manifests/web/engine_template.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77

88
<body>
99
<script id='poki-sdk-setup' type='text/javascript'>
10+
var isWasmLoaded = false;
11+
var isPokiSDKInited = false;
12+
var runFunc = function() {
13+
if (isPokiSDKInited && isWasmLoaded) {
14+
Module.runApp("canvas");
15+
}
16+
}
17+
Module['onRuntimeInitialized'] = function() {
18+
isWasmLoaded = true;
19+
runFunc();
20+
};
1021
function poki_sdk_loaded() {
1122
var data = {};
1223
var isLoadFinished = false;
@@ -19,17 +30,6 @@
1930
isLoadFinished = true;
2031
}
2132
});
22-
var isWasmLoaded = false;
23-
var isPokiSDKInited = false;
24-
var runFunc = function() {
25-
if (isPokiSDKInited && isWasmLoaded) {
26-
Module.runApp("canvas");
27-
}
28-
}
29-
Module['onRuntimeInitialized'] = function() {
30-
isWasmLoaded = true;
31-
runFunc();
32-
};
3333
PokiSDK.init().then(()=>{
3434
isPokiSDKInited = true;
3535
runFunc();

0 commit comments

Comments
 (0)