Skip to content

Commit

Permalink
use postMessage to tell creator of <iframe> to "Jump to Problem"
Browse files Browse the repository at this point in the history
  • Loading branch information
evancz committed Oct 11, 2019
1 parent 1e9d2f3 commit 71a5a82
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion worker/src/Endpoint/Compile.hs
Expand Up @@ -176,7 +176,12 @@ renderReport report =
<script src="https://worker.elm-lang.org/compile/errors.js"></script>
</head>
<body>
<script>Elm.Errors.init({flags:|] <> Encode.encodeUgly (Exit.toJson report) <> [r|});</script>
<script>
var app = Elm.Errors.init({flags:|] <> Encode.encodeUgly (Exit.toJson report) <> [r|});
app.ports.jumpTo.subscribe(function(region) {
window.parent.postMessage(JSON.stringify(region), '*');
});
</script>
</body>
</html>|]

Expand Down

0 comments on commit 71a5a82

Please sign in to comment.