OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 3 -- for details. All rights reserved. Use of this source code is governed by a |
| 4 -- BSD-style license that can be found in the LICENSE file. |
| 5 --> |
| 6 <html lang="en"> |
| 7 <head> |
| 8 <title>incremental_compilation_update_test.html</title> |
| 9 <meta charset="UTF-8"> |
| 10 </head> |
| 11 <body> |
| 12 <h1>incremental_compilation_update_test.html</h1> |
| 13 <pre id="console"></pre> |
| 14 <script type="application/javascript" src="print.js"></script> |
| 15 <script type="application/javascript"> |
| 16 /// Invoked by JavaScript code generated by dart2js when the program is ready |
| 17 /// to invoke main. |
| 18 function dartMainRunner(main) { |
| 19 // Invoke the "main" method of the Dart program. |
| 20 main(); |
| 21 |
| 22 // Let the sandbox embedder know that main is done running. |
| 23 window.parent.postMessage('iframe-dart-main-done', '*'); |
| 24 } |
| 25 (function() { |
| 26 |
| 27 /// Invoked when a 'message' event is received. Message events are generated |
| 28 /// with Window.postMessage and used to communicate between this iframe and |
| 29 /// its embedding parent page. |
| 30 function onMessage(e) { |
| 31 if (e.data[0] === 'add-script') { |
| 32 // Received a message on the form ['add-script', uri]. |
| 33 // Install a new script tag with the uri. |
| 34 var script = document.createElement('script'); |
| 35 script.src = e.data[1]; |
| 36 script.type = 'application/javascript'; |
| 37 document.body.appendChild(script); |
| 38 } else { |
| 39 // Other messages are just logged. |
| 40 console.log(e); |
| 41 } |
| 42 } |
| 43 window.addEventListener('message', onMessage, false); |
| 44 |
| 45 // Let the sandbox embedder know that this iframe is ready, that is, |
| 46 // listening for messages. |
| 47 window.parent.postMessage('iframe-ready', '*'); |
| 48 |
| 49 })(); |
| 50 </script> |
| 51 </body> |
| 52 </html> |
OLD | NEW |