aboutsummaryrefslogtreecommitdiff
path: root/src/library_glut.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/library_glut.js')
-rw-r--r--src/library_glut.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/library_glut.js b/src/library_glut.js
index 445e08a4..d6293d85 100644
--- a/src/library_glut.js
+++ b/src/library_glut.js
@@ -383,7 +383,7 @@ var LibraryGLUT = {
function callback() {
if (GLUT.idleFunc) {
Runtime.dynCall('v', GLUT.idleFunc);
- Browser.safeSetTimeout(callback, 0);
+ Browser.safeSetTimeout(callback, 4); // HTML spec specifies a 4ms minimum delay on the main thread; workers might get more, but we standardize here
}
}
if (!GLUT.idleFunc) {
@@ -489,8 +489,9 @@ var LibraryGLUT = {
GLUT.requestedAnimationFrame = true;
Browser.requestAnimationFrame(function() {
GLUT.requestedAnimationFrame = false;
- if (ABORT) return;
- Runtime.dynCall('v', GLUT.displayFunc);
+ Browser.mainLoop.runIter(function() {
+ Runtime.dynCall('v', GLUT.displayFunc);
+ });
});
}
},