on master help sign in
elm.debuggerStatus.eventCounter
4155b5eMichael James
runtime/Debugger.js+10−10
@@ -44,8 +44,8 @@ function debugModule(module, runtime) {
44 var watchTracker = Elm.Native.Debug.make(runtime).watchTracker;
44 var watchTracker = Elm.Native.Debug.make(runtime).watchTracker;
45 var pauseTime = 0;
45 var pauseTime = 0;
46 var eventsUntilSnapshot = EVENTS_PER_SAVE;
46 var eventsUntilSnapshot = EVENTS_PER_SAVE;
47− runtime.DebugStatus = runtime.DebugStatus || {};
47+ runtime.debuggerStatus = runtime.debuggerStatus || {};
48− runtime.DebugStatus.eventCounter = runtime.DebugStatus.eventCounter || 0;
48+ runtime.debuggerStatus.eventCounter = runtime.debuggerStatus.eventCounter || 0;
49
49
50 // runtime is the prototype of wrappedRuntime
50 // runtime is the prototype of wrappedRuntime
51 // so we can access all runtime properties too
51 // so we can access all runtime properties too
@@ -112,7 +112,7 @@ function debugModule(module, runtime) {
112 function recordEvent(id, v, timestep) {
112 function recordEvent(id, v, timestep) {
113 watchTracker.pushFrame();
113 watchTracker.pushFrame();
114 recordedEvents.push({ id:id, value:v, timestep:timestep });
114 recordedEvents.push({ id:id, value:v, timestep:timestep });
115− runtime.DebugStatus.eventCounter += 1;
115+ runtime.debuggerStatus.eventCounter += 1;
116 }
116 }
117
117
118 function clearAsyncCallbacks() {
118 function clearAsyncCallbacks() {
@@ -125,7 +125,7 @@ function debugModule(module, runtime) {
125
125
126 function clearRecordedEvents() {
126 function clearRecordedEvents() {
127 recordedEvents = [];
127 recordedEvents = [];
128− runtime.DebugStatus.eventCounter = 0;
128+ runtime.debuggerStatus.eventCounter = 0;
129 }
129 }
130
130
131 function getRecordedEventsLength() {
131 function getRecordedEventsLength() {
@@ -183,7 +183,7 @@ function debugModule(module, runtime) {
183 snapshots = snapshots.slice(0, lastSnapshotPosition + 1);
183 snapshots = snapshots.slice(0, lastSnapshotPosition + 1);
184 recordedEvents = recordedEvents.slice(0, position);
184 recordedEvents = recordedEvents.slice(0, position);
185 tracePath.clearTracesAfter(position);
185 tracePath.clearTracesAfter(position);
186− runtime.DebugStatus.eventCounter = position;
186+ runtime.debuggerStatus.eventCounter = position;
187 executeCallbacks(asyncCallbacks, false);
187 executeCallbacks(asyncCallbacks, false);
188 }
188 }
189 tracePath.startRecording();
189 tracePath.startRecording();
@@ -321,14 +321,14 @@ function debuggerInit(debugModule, runtime, hotSwapState /* =undefined */) {
321 debugModule.setPaused();
321 debugModule.setPaused();
322 debugModule.loadRecordedEvents(hotSwapState.recordedEvents);
322 debugModule.loadRecordedEvents(hotSwapState.recordedEvents);
323 var index = getMaxSteps();
323 var index = getMaxSteps();
324− runtime.DebugStatus.eventCounter = 0;
324+ runtime.debuggerStatus.eventCounter = 0;
325 debugModule.tracePath.clearTraces();
325 debugModule.tracePath.clearTraces();
326
326
327 // draw new trace path
327 // draw new trace path
328 debugModule.tracePath.startRecording();
328 debugModule.tracePath.startRecording();
329 while(currentEventIndex < index) {
329 while(currentEventIndex < index) {
330 var nextEvent = debugModule.getRecordedEventAt(currentEventIndex);
330 var nextEvent = debugModule.getRecordedEventAt(currentEventIndex);
331− runtime.DebugStatus.eventCounter += 1;
331+ runtime.debuggerStatus.eventCounter += 1;
332 runtime.notify(nextEvent.id, nextEvent.value, nextEvent.timestep);
332 runtime.notify(nextEvent.id, nextEvent.value, nextEvent.timestep);
333 debugModule.snapshotOnCheckpoint();
333 debugModule.snapshotOnCheckpoint();
334 currentEventIndex += 1;
334 currentEventIndex += 1;
@@ -413,14 +413,14 @@ function tracePathInit(runtime, signalGraphMain) {
413 else {
413 else {
414 tracePositions[id] = [pos];
414 tracePositions[id] = [pos];
415 }
415 }
416− if (tracePositions[id].length < runtime.DebugStatus.eventCounter) {
416+ if (tracePositions[id].length < runtime.debuggerStatus.eventCounter) {
417− var padCount = runtime.DebugStatus.eventCounter - tracePositions[id].length;
417+ var padCount = runtime.debuggerStatus.eventCounter - tracePositions[id].length;
418 var lastTracePosition = tracePositions[id][tracePositions[id].length - 1];
418 var lastTracePosition = tracePositions[id][tracePositions[id].length - 1];
419 for (var i = padCount; i--;) {
419 for (var i = padCount; i--;) {
420 tracePositions[id].push(lastTracePosition)
420 tracePositions[id].push(lastTracePosition)
421 }
421 }
422 }
422 }
423− assert(tracePositions[id].length === runtime.DebugStatus.eventCounter,
423+ assert(tracePositions[id].length === runtime.debuggerStatus.eventCounter,
424 "We don't have a 1-1 mapping of trace positions to events");
424 "We don't have a 1-1 mapping of trace positions to events");
425 }
425 }
426 }
426 }