on master help sign in
fixed off-track backstep after a while.
021af44Michael James
runtime/Debugger.js+6−4
@@ -83,11 +83,12 @@ function debugModule(module, runtime) {
83 else {
83 else {
84 var changed = runtime.notify(id, v, timestep);
84 var changed = runtime.notify(id, v, timestep);
85 recordEvent(id, v, timestep);
85 recordEvent(id, v, timestep);
86− if (eventsUntilSnapshot <= 1) {
86+ if (eventsUntilSnapshot === 1) {
87 saveSnapshot();
87 saveSnapshot();
88 eventsUntilSnapshot = EVENTS_PER_SAVE;
88 eventsUntilSnapshot = EVENTS_PER_SAVE;
89+ } else {
90+ eventsUntilSnapshot -= 1;
89 }
91 }
90− eventsUntilSnapshot -= 1;
91 if (parent.window) {
92 if (parent.window) {
92 parent.window.postMessage("elmNotify", window.location.origin);
93 parent.window.postMessage("elmNotify", window.location.origin);
93 }
94 }
@@ -319,11 +320,12 @@ function debuggerInit(debugModule, runtime, hotSwapState /* =undefined */) {
319 while(currentEventIndex < index) {
320 while(currentEventIndex < index) {
320 var nextEvent = debugModule.getRecordedEventAt(currentEventIndex);
321 var nextEvent = debugModule.getRecordedEventAt(currentEventIndex);
321 runtime.notify(nextEvent.id, nextEvent.value, nextEvent.timestep);
322 runtime.notify(nextEvent.id, nextEvent.value, nextEvent.timestep);
322− if (eventsUntilSnapshot <= 1) {
323+ if (eventsUntilSnapshot === 1) {
323 debugModule.saveSnapshot();
324 debugModule.saveSnapshot();
324 eventsUntilSnapshot = EVENTS_PER_SAVE;
325 eventsUntilSnapshot = EVENTS_PER_SAVE;
326+ } else {
327+ eventsUntilSnapshot -= 1;
325 }
328 }
326− eventsUntilSnapshot -= 1;
327 currentEventIndex += 1;
329 currentEventIndex += 1;
328 }
330 }
329 debugModule.tracePath.stopRecording();
331 debugModule.tracePath.stopRecording();