Skip to content

Commit 71a5a82

Browse files
committed
use postMessage to tell creator of <iframe> to "Jump to Problem"
1 parent 1e9d2f3 commit 71a5a82

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

worker/src/Endpoint/Compile.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,12 @@ renderReport report =
176176
<script src="https://worker.elm-lang.org/compile/errors.js"></script>
177177
</head>
178178
<body>
179-
<script>Elm.Errors.init({flags:|] <> Encode.encodeUgly (Exit.toJson report) <> [r|});</script>
179+
<script>
180+
var app = Elm.Errors.init({flags:|] <> Encode.encodeUgly (Exit.toJson report) <> [r|});
181+
app.ports.jumpTo.subscribe(function(region) {
182+
window.parent.postMessage(JSON.stringify(region), '*');
183+
});
184+
</script>
180185
</body>
181186
</html>|]
182187

0 commit comments

Comments
 (0)