Open toolness opened 11 years ago
This is what I did to add the call to stamp()
to every render:
diff --git a/lab/lab.js b/lab/lab.js
index b277c99..638e71a 100644
--- a/lab/lab.js
+++ b/lab/lab.js
@@ -86,10 +86,12 @@ var Lab = typeof(window) == 'undefined'
turtle = new TinyTurtle(canvas);
worker = new Worker(workerURL);
worker.onmessage = function(e) {
- if (e.data.msg == 'done')
+ if (e.data.msg == 'done') {
+ cmds.push({args: [], method: 'stamp', msg: 'turtle-methodcall'});
finishWorker(cmds, null);
- else
+ } else {
cmds.push(e.data);
+ }
};
worker.onerror = finishWorker.bind(null, cmds);
worker.postMessage({
The
stamp()
function is confusing to learners; we might just want to do it ourselves at the end of the render process.