Compiler: simplify loaded state

pull/1/head
Alex Beregszaszi 9 years ago
parent 6305c6da36
commit d18ba0156a
  1. 19
      src/app/compiler.js

@ -63,7 +63,13 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
editor.setAnnotations(sourceAnnotations);
};
function onCompilerLoaded (setVersionText) {
function onCompilerLoaded (setVersionText, version) {
setVersionText(version);
previousInput = '';
onChange();
}
function onInternalCompilerLoaded (setVersionText) {
if (worker === null) {
var compile;
var missingInputs = [];
@ -92,11 +98,9 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
}
compilationFinished(result, missingInputs);
};
setVersionText(Module.cwrap('version', 'string', [])());
onCompilerLoaded(setVersionText, Module.cwrap('version', 'string', [])());
}
previousInput = '';
onChange();
};
}
function compilationFinished (result, missingInputs) {
var data;
@ -153,7 +157,7 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
return;
}
window.clearInterval(check);
onCompilerLoaded(setVersionText);
onInternalCompilerLoaded(setVersionText);
}, 200);
}
@ -166,9 +170,8 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
var data = msg.data;
switch (data.cmd) {
case 'versionLoaded':
setVersionText(data.data);
compilerAcceptsMultipleFiles = !!data.acceptsMultipleFiles;
onCompilerLoaded(setVersionText);
onCompilerLoaded(setVersionText, data.data);
break;
case 'compiled':
compilationFinished(data.data, data.missingInputs);

Loading…
Cancel
Save