on master help sign in
Debugger: use onload and postMessage to allow debugger to reload, and still connect with UI.
48a1126Laszlo Pandy
runtime/Debugger.js+11
@@ -8,6 +8,17 @@ Elm.debuggerAttach = function(module) {
8 make: function(runtime) {
8 make: function(runtime) {
9 var wrappedModule = debugModule(module, runtime);
9 var wrappedModule = debugModule(module, runtime);
10 Elm.Debugger = debuggerInit(wrappedModule, runtime);
10 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 return wrappedModule.moduleInstance;
22 return wrappedModule.moduleInstance;
12 }
23 }
13 };
24 };