diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-09-23 10:14:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-23 10:14:22 +0200 |
commit | c10e8ac1de356be4e85744818392eef2a1443e99 (patch) | |
tree | 8b2a58f9303337e13fc466b09a1dad68e955688f /platform/javascript/engine/engine.js | |
parent | 0c449aefa2732fbf16161e8b9a9dddca84a36cd0 (diff) | |
parent | dccd71c7a36fc31f6cc19e0f7f587fb0860c973a (diff) |
Merge pull request #42178 from Faless/js/sync_fs_size_handlers
[HTML5] Synchronous main, better persistence, handlers fixes, optional full screen.
Diffstat (limited to 'platform/javascript/engine/engine.js')
-rw-r--r-- | platform/javascript/engine/engine.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/platform/javascript/engine/engine.js b/platform/javascript/engine/engine.js index 2630812814..adcd919a6b 100644 --- a/platform/javascript/engine/engine.js +++ b/platform/javascript/engine/engine.js @@ -33,6 +33,7 @@ Function('return this')()['Engine'] = (function() { this.resizeCanvasOnStart = false; this.onExecute = null; this.onExit = null; + this.persistentPaths = []; }; Engine.prototype.init = /** @param {string=} basePath */ function(basePath) { @@ -56,12 +57,14 @@ Function('return this')()['Engine'] = (function() { config['locateFile'] = Utils.createLocateRewrite(loadPath); config['instantiateWasm'] = Utils.createInstantiatePromise(loadPromise); Godot(config).then(function(module) { - me.rtenv = module; - if (unloadAfterInit) { - unload(); - } - resolve(); - config = null; + module['initFS'](me.persistentPaths).then(function(fs_err) { + me.rtenv = module; + if (unloadAfterInit) { + unload(); + } + resolve(); + config = null; + }); }); }); return initPromise; @@ -220,6 +223,10 @@ Function('return this')()['Engine'] = (function() { this.rtenv['copyToFS'](path, buffer); }; + Engine.prototype.setPersistentPaths = function(persistentPaths) { + this.persistentPaths = persistentPaths; + }; + // Closure compiler exported engine methods. /** @export */ Engine['isWebGLAvailable'] = Utils.isWebGLAvailable; @@ -241,5 +248,6 @@ Function('return this')()['Engine'] = (function() { Engine.prototype['setOnExecute'] = Engine.prototype.setOnExecute; Engine.prototype['setOnExit'] = Engine.prototype.setOnExit; Engine.prototype['copyToFS'] = Engine.prototype.copyToFS; + Engine.prototype['setPersistentPaths'] = Engine.prototype.setPersistentPaths; return Engine; })(); |