OLD | NEW |
1 import 'dart:html'; | 1 import 'dart:html'; |
2 import 'dart:json'; | 2 import 'dart:json' as json; |
3 import 'dart:math' as Math; | 3 import 'dart:math' as Math; |
4 import 'Suites.dart'; | 4 import 'Suites.dart'; |
5 | 5 |
6 main() { | 6 main() { |
7 new Dromaeo().run(); | 7 new Dromaeo().run(); |
8 } | 8 } |
9 | 9 |
10 class SuiteController { | 10 class SuiteController { |
11 final SuiteDescription _suiteDescription; | 11 final SuiteDescription _suiteDescription; |
12 final IFrameElement _suiteIframe; | 12 final IFrameElement _suiteIframe; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 final List<SuiteController> _suiteControllers; | 88 final List<SuiteController> _suiteControllers; |
89 Function _handler; | 89 Function _handler; |
90 | 90 |
91 Dromaeo() | 91 Dromaeo() |
92 : _suiteControllers = new List<SuiteController>() | 92 : _suiteControllers = new List<SuiteController>() |
93 { | 93 { |
94 _handler = _createHandler(); | 94 _handler = _createHandler(); |
95 window.on.message.add( | 95 window.on.message.add( |
96 (MessageEvent event) { | 96 (MessageEvent event) { |
97 try { | 97 try { |
98 final response = JSON.parse(event.data); | 98 final response = json.parse(event.data); |
99 _handler = _handler(response['command'], response['data']); | 99 _handler = _handler(response['command'], response['data']); |
100 } catch (e, stacktrace) { | 100 } catch (e, stacktrace) { |
101 window.alert('Exception: ${e}: ${stacktrace}'); | 101 window.alert('Exception: ${e}: ${stacktrace}'); |
102 } | 102 } |
103 }, | 103 }, |
104 false | 104 false |
105 ); | 105 ); |
106 } | 106 } |
107 | 107 |
108 run() { | 108 run() { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } | 213 } |
214 | 214 |
215 Element _byId(String id) { | 215 Element _byId(String id) { |
216 return document.query('#$id'); | 216 return document.query('#$id'); |
217 } | 217 } |
218 | 218 |
219 int get _suitesTotal { | 219 int get _suitesTotal { |
220 return _suiteControllers.length; | 220 return _suiteControllers.length; |
221 } | 221 } |
222 } | 222 } |
OLD | NEW |