Browse Source

EmscriptenApplication: use existing Module object in WindowlessEmscriptenApplication.js as well

pull/480/head
Pablo Escobar 6 years ago
parent
commit
b636fdbe0e
  1. 42
      src/Magnum/Platform/WindowlessEmscriptenApplication.js

42
src/Magnum/Platform/WindowlessEmscriptenApplication.js

@ -23,49 +23,50 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
var Module = { var Module = typeof Module !== "undefined" ? Module : {};
preRun: [],
postRun: [],
arguments: [], Module.preRun = [];
Module.postRun = [];
doNotCaptureKeyboard: true, Module.arguments = [];
printErr: function(message) { Module.doNotCaptureKeyboard = true;
Module.printErr = function(message) {
var log = document.getElementById('log'); var log = document.getElementById('log');
log.innerHTML += Array.prototype.slice.call(arguments).join(' ') log.innerHTML += Array.prototype.slice.call(arguments).join(' ')
.replace(/[\"&<>]/g, function (a) { .replace(/[\"&<>]/g, function (a) {
return { '"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;' }[a]; return { '"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;' }[a];
}) + '\n'; }) + '\n';
}, };
print: function(message) { Module.print = function(message) {
var log = document.getElementById('log'); var log = document.getElementById('log');
log.innerHTML += Array.prototype.slice.call(arguments).join(' ') log.innerHTML += Array.prototype.slice.call(arguments).join(' ')
.replace(/[\"&<>]/g, function (a) { .replace(/[\"&<>]/g, function (a) {
return { '"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;' }[a]; return { '"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;' }[a];
}) + '\n'; }) + '\n';
}, };
/* onAbort not handled here, as the output is printed directly on the page */ /* onAbort not handled here, as the output is printed directly on the page */
canvas: document.getElementById('canvas'), Module.canvas = document.getElementById('canvas');
status: document.getElementById('status'), Module.status = document.getElementById('status');
statusDescription: document.getElementById('status-description'), Module.statusDescription = document.getElementById('status-description');
log: document.getElementById('log'), Module.log = document.getElementById('log');
setStatus: function(message) { Module.setStatus = function(message) {
if(Module.status) Module.status.innerHTML = message; if(Module.status) Module.status.innerHTML = message;
}, };
setStatusDescription: function(message) { Module.setStatusDescription = function(message) {
if(Module.statusDescription) if(Module.statusDescription)
Module.statusDescription.innerHTML = message; Module.statusDescription.innerHTML = message;
}, };
totalDependencies: 0, Module.totalDependencies = 0;
monitorRunDependencies: function(left) { Module.monitorRunDependencies = function(left) {
this.totalDependencies = Math.max(this.totalDependencies, left); this.totalDependencies = Math.max(this.totalDependencies, left);
if(left) { if(left) {
@ -76,7 +77,6 @@ var Module = {
Module.setStatusDescription(''); Module.setStatusDescription('');
Module.log.style.display = 'block'; Module.log.style.display = 'block';
} }
}
}; };
/* Parse arguments, e.g. /app/?foo=bar&fizz&buzz=3 goes to the app as /* Parse arguments, e.g. /app/?foo=bar&fizz&buzz=3 goes to the app as

Loading…
Cancel
Save