on master help sign in
Debugger: move tracePath signal node to trace path module.
52ae89cLaszlo Pandy
runtime/Debugger.js+6−7
@@ -120,7 +120,7 @@ function debugModule(module, runtime) {
120
120
121 var moduleInstance = module.make(wrappedRuntime);
121 var moduleInstance = module.make(wrappedRuntime);
122 var moduleNodes = flattenNodes(wrappedRuntime.inputs);
122 var moduleNodes = flattenNodes(wrappedRuntime.inputs);
123− var tracePath = tracePathInit(runtime);
123+ var tracePath = tracePathInit(runtime, moduleInstance.main);
124
124
125 return {
125 return {
126 moduleInstance: moduleInstance,
126 moduleInstance: moduleInstance,
@@ -141,11 +141,6 @@ function debugModule(module, runtime) {
141}
141}
142
142
143function debuggerInit(debugModule, runtime, hotSwapState /* =undefined */) {
143function debuggerInit(debugModule, runtime, hotSwapState /* =undefined */) {
144− var Signal = Elm.Signal.make(runtime);
145−
146− var tracePathNode = A2(Signal.lift, debugModule.tracePath.graphicsUpdate, debugModule.moduleInstance.main);
147− runtime.node.parentNode.appendChild(debugModule.tracePath.canvas);
148−
149 var eventCounter = 0;
144 var eventCounter = 0;
150
145
151 function resetProgram() {
146 function resetProgram() {
@@ -248,6 +243,8 @@ function debuggerInit(debugModule, runtime, hotSwapState /* =undefined */) {
248 stepTo(hotSwapState.eventCounter);
243 stepTo(hotSwapState.eventCounter);
249 }
244 }
250
245
246+ runtime.node.parentNode.appendChild(debugModule.tracePath.canvas);
247+
251 var elmDebugger = {
248 var elmDebugger = {
252 restart: restartProgram,
249 restart: restartProgram,
253 pause: pauseProgram,
250 pause: pauseProgram,
@@ -277,8 +274,10 @@ function Point(x, y) {
277 }
274 }
278}
275}
279
276
280−function tracePathInit(runtime) {
277+function tracePathInit(runtime, mainNode) {
281 var List = Elm.List.make(runtime);
278 var List = Elm.List.make(runtime);
279+ var Signal = Elm.Signal.make(runtime);
280+ var tracePathNode = A2(Signal.lift, graphicsUpdate, mainNode);
282 var tracePathCanvas = createCanvas();
281 var tracePathCanvas = createCanvas();
283 var tracePositions = {};
282 var tracePositions = {};
284 var recordingTraces = true;
283 var recordingTraces = true;