Elm.Native.Debug = {}; Elm.Native.Debug.make = function(elm) { elm.Native = elm.Native || {}; elm.Native.Debug = elm.Native.Debug || {}; if (elm.Native.Debug.values) return elm.Native.Debug.values; if ('values' in Elm.Native.Debug) return elm.Native.Debug.values = Elm.Native.Debug.values; var show = Elm.Native.Show.make(elm).show; var replace = Elm.Native.Utils.make(elm).replace; function log(tag, value) { var msg = tag + ': ' + show(value); var process = process || {}; if (process.stdout) { process.stdout.write(msg); } else { console.log(msg); } return value; } function tracePath(debugId, form) { return replace([["debugTracePathId",debugId]], form); } function WatchTracker() { this.frames = [{}]; this.clear = function() { this.watches = {}; }; this.pushFrame = function() { var lastFrame = this.frames[this.frames.length - 1]; this.frames.push(lastFrame); } this.notify = function(tag, value) { this.frames[this.frames.length - 1][tag] = value; }; } var watchTracker = new WatchTracker(); function watch(tag, value) { watchTracker.notify(tag, value); return value; } function watchSummary(tag, f, value) { watchTracker.notify(tag, f(value)); return value; } Elm.Native.Debug.values = { tracePath: F2(tracePath), log: F2(log), watch: F2(watch), watchSummary:F3(watchSummary), watchTracker: watchTracker }; return elm.Native.Debug.values = Elm.Native.Debug.values; };