aboutsummaryrefslogtreecommitdiff
path: root/src/proxyClient.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-06-12 17:19:21 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-06-12 17:19:21 -0700
commite141881ad1b43a1cf5ab9a570b52f11ce5befc62 (patch)
tree195882f36be1c59082c7a49757d7ca0869f2a7f7 /src/proxyClient.js
parent68e6cd231b58ae8fe2a921ba43675317ecfd84b0 (diff)
throttle proxied frames
Diffstat (limited to 'src/proxyClient.js')
-rw-r--r--src/proxyClient.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/proxyClient.js b/src/proxyClient.js
index f8615bae..1c9b6548 100644
--- a/src/proxyClient.js
+++ b/src/proxyClient.js
@@ -24,6 +24,12 @@ window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequest
// end render
+// Frame throttling
+
+var frameId = 0;
+
+// Worker
+
var worker = new Worker('{{{ filename }}}.js');
WebGLClient.prefetch(); // XXX not guaranteed to be before worker main()
@@ -84,6 +90,11 @@ worker.onmessage = function worker_onmessage(event) {
Module.glClient.onmessage(data);
break;
}
+ case 'tick': {
+ frameId = data.id;
+ worker.postMessage({ target: 'tock', id: frameId });
+ break;
+ }
default: throw 'what?';
}
};