on master help sign in
feed what should be the previous time to tick from the debugger
commit3c528c61c1e349024e836d220e42f23b94a1a2bd authorMichael James <michael@michaelbjames.com> dateWed 30 Jul 2014, 11:49 (12 years ago) parentab1ba45
2 files changed+7−4
libraries/Native/Signal/Time.js+4−1 runtime/Debugger.js+3−3
libraries/Native/Signal/Time.js+4−1
@@ -14,8 +14,11 @@ Elm.Native.Time.make = function(elm) {
1414 var msPerFrame = 1000 / desiredFPS;
1515 var prev = elm.timer.now(), curr = prev, diff = 0, wasOn = true;
1616 var ticker = NS.input(diff);
17− function tick(zero) { return function() {
17+ function tick(zero) { return function(previousTime /* =undefined */) {
1818 curr = elm.timer.now();
19+ if (previousTime) {
20+ prev = previousTime;
21+ }
1922 diff = zero ? 0 : curr - prev;
2023 prev = curr;
2124 elm.notify(ticker.id, diff);
runtime/Debugger.js+3−3
@@ -187,7 +187,7 @@ function debugModule(module, runtime) {
187187 recordedEvents = recordedEvents.slice(0, position);
188188 tracePath.clearTracesAfter(position);
189189 eventCounter = position;
190− executeCallbacks(asyncCallbacks, false);
190+ executeCallbacks(asyncCallbacks, false, lastEventTime);
191191 }
192192 tracePath.startRecording();
193193 }
@@ -491,12 +491,12 @@ function tracePathInit(runtime, signalGraphMain) {
491491 }
492492}
493493
494−function executeCallbacks(callbacks, reexecute) {
494+function executeCallbacks(callbacks, reexecute, previousTime /* =undefined */) {
495495 callbacks.forEach(function(timer) {
496496 if (reexecute || !timer.executed) {
497497 var func = timer.func;
498498 timer.executed = true;
499− func();
499+ func(previousTime);
500500 }
501501 });
502502}