Fix Closure compiler build, python style.

Move copyToFS into utils.js library included with '--pre-js'.
This commit is contained in:
Fabio Alessandrelli 2020-05-08 16:55:01 +02:00
parent 7411e7fd37
commit d2eef39731
11 changed files with 79 additions and 50 deletions

View file

@ -82,7 +82,7 @@ Function('return this')()['Engine'] = (function() {
var me = this;
return me.init().then(function() {
if (!me.rtenv) {
reject(new Error('The engine must be initialized before it can be started'));
return Promise.reject(new Error('The engine must be initialized before it can be started'));
}
if (!(me.canvas instanceof HTMLCanvasElement)) {
@ -124,7 +124,7 @@ Function('return this')()['Engine'] = (function() {
}
return new Promise(function(resolve, reject) {
preloader.preloadedFiles.forEach(function(file) {
Utils.copyToFS(me.rtenv['FS'], file.path, file.buffer);
me.rtenv['copyToFS'](file.path, file.buffer);
});
preloader.preloadedFiles.length = 0; // Clear memory
me.rtenv['callMain'](args);
@ -217,7 +217,7 @@ Function('return this')()['Engine'] = (function() {
if (this.rtenv == null) {
throw new Error("Engine must be inited before copying files");
}
Utils.copyToFS(this.rtenv['FS'], path, buffer);
this.rtenv['copyToFS'](path, buffer);
}
// Closure compiler exported engine methods.