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

Loading…
Cancel
Save