Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: site/try/src/run.dart

Issue 2232273004: Delete site/try (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library trydart.run;
6
7 import 'dart:html' show
8 Blob,
9 IFrameElement,
10 Url;
11
12 makeOutputFrame(String scriptUrl) {
13 final String outputHtml = '''
14 <!DOCTYPE html>
15 <html lang="en">
16 <head>
17 <title>JavaScript output</title>
18 <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
19 </head>
20 <body>
21 <script type="application/javascript" src="$outputHelper"></script>
22 <script type="application/javascript" src="$scriptUrl"></script>
23 </body>
24 </html>
25 ''';
26
27 return new IFrameElement()
28 ..src = Url.createObjectUrl(new Blob([outputHtml], "text/html"))
29 ..style.width = '100%'
30 ..style.height = '0px';
31 }
32
33 final String outputHelper =
34 Url.createObjectUrl(new Blob([OUTPUT_HELPER], 'application/javascript'));
35
36 const String OUTPUT_HELPER = r'''
37 function dartPrint(msg) {
38 // Send a message to the main Try Dart window.
39 window.parent.postMessage(String(msg), "*");
40 }
41
42 function dartMainRunner(main) {
43 // Store the current height (of an empty document). This implies that the
44 // main Try Dart application is only notified if the document is actually
45 // changed.
46 var previousScrollHeight = document.documentElement.scrollHeight;
47
48 function postScrollHeight(mutations, observer) {
49 var scrollHeight = document.documentElement.scrollHeight;
50 if (scrollHeight !== previousScrollHeight) {
51 previousScrollHeight = scrollHeight;
52 window.parent.postMessage(["scrollHeight", scrollHeight], "*");
53 }
54 }
55
56 var MutationObserver =
57 window.MutationObserver ||
58 window.WebKitMutationObserver ||
59 window.MozMutationObserver;
60
61 // Listen to any changes to the DOM.
62 new MutationObserver(postScrollHeight).observe(
63 document.documentElement,
64 { attributes: true,
65 childList: true,
66 characterData: true,
67 subtree: true });
68
69 main();
70 }
71 ''';
OLDNEW
« dart.gyp ('K') | « site/try/src/mock.dart ('k') | site/try/src/samples.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698