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

Side by Side Diff: site/try/src/leap.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.main;
6
7 import 'dart:html' show
8 HttpRequest,
9 LinkElement,
10 querySelector,
11 window;
12
13 import 'dart:isolate' show
14 Isolate,
15 ReceivePort,
16 SendPort;
17
18 import 'compilation.dart' show
19 compilerPort,
20 currentSource;
21
22 import 'samples.dart' show
23 EXAMPLE_HELLO;
24
25 import 'ui.dart' show
26 buildUI,
27 interaction,
28 observer;
29
30 import 'user_option.dart' show
31 UserOption;
32
33 import 'settings.dart' show
34 alwaysRunInIframe,
35 communicateViaBlobs;
36
37 bool isBrowserIE() {
38 return window.navigator.userAgent.contains(' Trident/7.0;');
39 }
40
41 initHiddenSettings() {
42 alwaysRunInIframe.setIfNotInitialized(isBrowserIE);
43 communicateViaBlobs.setIfNotInitialized(() => !isBrowserIE());
44 }
45
46 int count = 0;
47
48 main() {
49 UserOption.storage = window.localStorage;
50 if (currentSource == null) {
51 currentSource = EXAMPLE_HELLO;
52 }
53
54 initHiddenSettings();
55
56 buildUI();
57 ReceivePort port = new ReceivePort();
58 Isolate.spawnUri(
59 Uri.base.resolve('compiler_isolate.dart.js'),
60 const <String>[], port.sendPort).then((Isolate isolate) {
61 LinkElement link = querySelector('link[rel="dart-sdk"]');
62 String sdk = link.href;
63 print('Using Dart SDK: $sdk');
64 int messageCount = 0;
65 SendPort sendPort;
66 port.listen((message) {
67 messageCount++;
68 switch (messageCount) {
69 case 1:
70 sendPort = message as SendPort;
71 sendPort.send([sdk, port.sendPort]);
72 break;
73 case 2:
74 // Acknowledged Receiving the SDK URI.
75 compilerPort = sendPort;
76 interaction.onMutation([], observer);
77 break;
78 default:
79 // TODO(ahe): Close [port]?
80 print('Unexpected message received: $message');
81 break;
82 }
83 });
84 });
85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698