Skip to content

Commit

Permalink
Merge pull request #20 from ekharkunov/issue-19-loading-error
Browse files Browse the repository at this point in the history
Fix loading error when poki sdk script loads later than all other game stuff
  • Loading branch information
AGulev authored Jan 10, 2025
2 parents f166959 + 05ca5ea commit 9254b9a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions poki-sdk/manifests/web/engine_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@

<body>
<script id='poki-sdk-setup' type='text/javascript'>
var isWasmLoaded = false;
var isPokiSDKInited = false;
var runFunc = function() {
if (isPokiSDKInited && isWasmLoaded) {
Module.runApp("canvas");
}
}
Module['onRuntimeInitialized'] = function() {
isWasmLoaded = true;
runFunc();
};
function poki_sdk_loaded() {
var data = {};
var isLoadFinished = false;
Expand All @@ -19,17 +30,6 @@
isLoadFinished = true;
}
});
var isWasmLoaded = false;
var isPokiSDKInited = false;
var runFunc = function() {
if (isPokiSDKInited && isWasmLoaded) {
Module.runApp("canvas");
}
}
Module['onRuntimeInitialized'] = function() {
isWasmLoaded = true;
runFunc();
};
PokiSDK.init().then(()=>{
isPokiSDKInited = true;
runFunc();
Expand Down

0 comments on commit 9254b9a

Please sign in to comment.