@@ -8,22 +8,26 @@ Elm.debuggerAttach = function(module) {
88 make: function(runtime) {
99 var wrappedModule = debugModule(module, runtime);
1010 Elm.Debugger = debuggerInit(wrappedModule, runtime);
11− if (parent.window) {
12− var dispatch = function(_) {
13− parent.window.postMessage("elmDebuggerInit", window.location.origin);
14− };
15− if (parent.window.document.readyState === "complete") {
16− dispatch();
17− }
18− else {
19− parent.window.addEventListener("load", dispatch);
20− }
21− }
11+ dispatchElmDebuggerInit();
2212 return wrappedModule.moduleInstance;
2313 }
2414 };
2515};
2616
17+function dispatchElmDebuggerInit() {
18+ if (parent.window) {
19+ var dispatch = function(_) {
20+ parent.window.postMessage("elmDebuggerInit", window.location.origin);
21+ };
22+ if (parent.window.document.readyState === "complete") {
23+ dispatch();
24+ }
25+ else {
26+ parent.window.addEventListener("load", dispatch);
27+ }
28+ }
29+}
30+
2731function debugModule(module, runtime) {
2832 var programPaused = false;
2933 var recordedEvents = [];