Commit 89150107 authored by Alex Beregszaszi's avatar Alex Beregszaszi

Use window.Module to be canonical

parent d568c939
......@@ -7,11 +7,13 @@ module.exports = function (self) {
var data = e.data;
switch (data.cmd) {
case 'loadVersion':
delete Module;
delete window.Module;
version = null;
compileJSON = null;
importScripts(data.data);
var Module = window.Module;
version = Module.cwrap('version', 'string', []);
if ('_compileJSONCallback' in Module) {
var compileJSONInternal = Module.cwrap('compileJSONCallback', 'string', ['string', 'number', 'number']);
......
......@@ -73,6 +73,7 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
if (worker === null) {
var compile;
var missingInputs = [];
var Module = window.Module;
if ('_compileJSONCallback' in Module) {
compilerAcceptsMultipleFiles = true;
var missingInputsCallback = Module.Runtime.addFunction(function (path, contents, error) {
......@@ -146,7 +147,7 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
};
function loadInternal (url, setVersionText) {
Module = null;
delete window.Module;
// Set a safe fallback until the new one is loaded
compileJSON = function (source, optimize) { compilationFinished('{}'); };
......@@ -155,7 +156,7 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
newScript.src = url;
document.getElementsByTagName('head')[0].appendChild(newScript);
var check = window.setInterval(function () {
if (!Module) {
if (!window.Module) {
return;
}
window.clearInterval(check);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment