| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library trydart.main; | 5 library trydart.main; |
| 6 | 6 |
| 7 import 'dart:html' show | 7 import 'dart:html' show |
| 8 HttpRequest, | 8 HttpRequest, |
| 9 LinkElement, | 9 LinkElement, |
| 10 querySelector, | 10 querySelector, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 EXAMPLE_HELLO; | 24 EXAMPLE_HELLO; |
| 25 | 25 |
| 26 import 'ui.dart' show | 26 import 'ui.dart' show |
| 27 buildUI, | 27 buildUI, |
| 28 interaction, | 28 interaction, |
| 29 observer; | 29 observer; |
| 30 | 30 |
| 31 import 'user_option.dart' show | 31 import 'user_option.dart' show |
| 32 UserOption; | 32 UserOption; |
| 33 | 33 |
| 34 import 'settings.dart' show |
| 35 alwaysRunInIframe, |
| 36 communicateViaBlobs; |
| 37 |
| 38 bool isBrowserIE() { |
| 39 return window.navigator.userAgent.contains(' Trident/7.0;'); |
| 40 } |
| 41 |
| 42 initHiddenSettings() { |
| 43 alwaysRunInIframe.setIfNotInitialized(isBrowserIE); |
| 44 communicateViaBlobs.setIfNotInitialized(() => !isBrowserIE()); |
| 45 } |
| 46 |
| 34 int count = 0; | 47 int count = 0; |
| 35 | 48 |
| 36 main() { | 49 main() { |
| 37 UserOption.storage = window.localStorage; | 50 UserOption.storage = window.localStorage; |
| 38 if (currentSource == null) { | 51 if (currentSource == null) { |
| 39 currentSource = EXAMPLE_HELLO; | 52 currentSource = EXAMPLE_HELLO; |
| 40 } | 53 } |
| 41 | 54 |
| 55 initHiddenSettings(); |
| 56 |
| 42 buildUI(); | 57 buildUI(); |
| 43 ReceivePort port = new ReceivePort(); | 58 ReceivePort port = new ReceivePort(); |
| 44 Isolate.spawnUri( | 59 Isolate.spawnUri( |
| 45 Uri.base.resolve('compiler_isolate.dart.js'), | 60 Uri.base.resolve('compiler_isolate.dart.js'), |
| 46 const <String>[], port.sendPort).then((Isolate isolate) { | 61 const <String>[], port.sendPort).then((Isolate isolate) { |
| 47 LinkElement link = querySelector('link[rel="dart-sdk"]'); | 62 LinkElement link = querySelector('link[rel="dart-sdk"]'); |
| 48 String sdk = link.href; | 63 String sdk = link.href; |
| 49 print('Using Dart SDK: $sdk'); | 64 print('Using Dart SDK: $sdk'); |
| 50 int messageCount = 0; | 65 int messageCount = 0; |
| 51 SendPort sendPort; | 66 SendPort sendPort; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 62 interaction.onMutation([], observer); | 77 interaction.onMutation([], observer); |
| 63 break; | 78 break; |
| 64 default: | 79 default: |
| 65 // TODO(ahe): Close [port]? | 80 // TODO(ahe): Close [port]? |
| 66 print('Unexpected message received: $message'); | 81 print('Unexpected message received: $message'); |
| 67 break; | 82 break; |
| 68 } | 83 } |
| 69 }); | 84 }); |
| 70 }); | 85 }); |
| 71 } | 86 } |
| OLD | NEW |