diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-28 10:40:00 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-28 10:40:00 -0700 |
commit | 9e5b0a8bb6ad0222f9a8a328bd36481656b7009f (patch) | |
tree | 6f134bf983c3022aab6e302807f8944b6bb13606 /src/shell.html | |
parent | b5c2757c7c54b08b4cb5a0524a2b64c11eb7d65d (diff) |
optimize Module.setStatus
Diffstat (limited to 'src/shell.html')
-rw-r--r-- | src/shell.html | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/shell.html b/src/shell.html index a33735d9..53a4fffb 100644 --- a/src/shell.html +++ b/src/shell.html @@ -63,8 +63,11 @@ }, canvas: document.getElementById('canvas'), setStatus: function(text) { - if (Module.setStatus.interval) clearInterval(Module.setStatus.interval); + if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' }; + if (text === Module.setStatus.text) return; var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/); + var now = Date.now(); + if (m && now - Date.now() < 30) return; // if this is a progress update, skip it if too soon var statusElement = document.getElementById('status'); var progressElement = document.getElementById('progress'); if (m) { |