aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-05-12 19:00:45 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-05-12 19:00:45 -0700
commit15d0f8bf3db70eaf915f1af0b205d751c9edceaa (patch)
tree0e225555dfb10fe065b730ba6e5e43b364aa9aae
parentb9f86b8fa3edc99805b5ace739df9c44ba8dc352 (diff)
nicer html messages during load/startup
-rw-r--r--src/postamble.js13
-rw-r--r--src/shell.html26
2 files changed, 30 insertions, 9 deletions
diff --git a/src/postamble.js b/src/postamble.js
index 24b8e4a1..7a9785c8 100644
--- a/src/postamble.js
+++ b/src/postamble.js
@@ -32,10 +32,6 @@ Module.callMain = function callMain(args) {
function run(args) {
args = args || Module['arguments'];
- if (Module['setStatus']) {
- Module['setStatus'](''); // clear the status from "Downloading.." etc.
- }
-
if (Module['preRun']) {
Module['preRun']();
if (runDependencies > 0) {
@@ -45,6 +41,15 @@ function run(args) {
}
}
+ if (Module['setStatus']) {
+ Module['setStatus']('Running...');
+#if GENERATING_HTML
+ setTimeout(function() {
+ Module['setStatus'](''); // clear 'Running...' after first frame
+ }, 1);
+#endif
+ }
+
var ret = null;
if (Module['_main']) {
preMain();
diff --git a/src/shell.html b/src/shell.html
index bf81c971..035cd5ef 100644
--- a/src/shell.html
+++ b/src/shell.html
@@ -12,14 +12,14 @@
</style>
</head>
<body>
+ <hr/>
+ <div class="emscripten" id="status">Downloading...</div>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
- <ht/>
+ <hr/>
<div class="emscripten"><input type="button" value="fullscreen" onclick="Module.requestFullScreen()"></div>
<hr/>
<textarea class="emscripten" id="output" rows="8"></textarea>
<hr>
- <div class="emscripten" id="status">Downloading...</div>
- <hr>
<script type='text/javascript'>
// connect to canvas
var Module = {
@@ -38,14 +38,30 @@
})(),
canvas: document.getElementById('canvas'),
setStatus: function(text) {
- document.getElementById('status').innerHTML = text;
+ if (Module.setStatus.interval) clearInterval(Module.setStatus.interval);
+ document.getElementById('status').innerHTML = '';
+ if (text) {
+ var counter = 0;
+ Module.setStatus.interval = setInterval(function() {
+ counter++;
+ counter %= 3;
+ var dots = ' ';
+ for (var i = 0; i < counter; i++) dots += '.';
+ dots += '*';
+ for (var i = counter; i < 2; i++) dots += '.';
+ document.getElementById('status').innerHTML = text.replace('...', dots);
+ }, 300);
+ }
},
totalDependencies: 0,
monitorRunDependencies: function(left) {
this.totalDependencies = Math.max(this.totalDependencies, left);
- Module.setStatus(left ? 'Downloading: ' + (this.totalDependencies-left) + '/' + this.totalDependencies : 'All downloads complete.');
+ Module.setStatus(left ? 'Downloading: ' + (this.totalDependencies-left) + '/' + this.totalDependencies + '...' : 'All downloads complete.');
}
};
+ Module.setStatus('Downloading...');
+ </script>
+ <script type='text/javascript'>
{{{ SCRIPT_CODE }}}