on master help sign in
Debugger: use onload and postMessage to allow debugger to reload, and still connect with UI.
commit48a1126a2fa6900b557ede8bc82f8201a33c5c71 authorLaszlo Pandy <laszlo.pandy@prezi.com> dateMon 4 Nov 2013, 16:28 (13 years ago) parent8f510a5
1 file changed+11
runtime/Debugger.js+11
runtime/Debugger.js+11
@@ -8,6 +8,17 @@ 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+ }
1122 return wrappedModule.moduleInstance;
1223 }
1324 };