| OLD | NEW |
| 1 #import('dart:dom'); | 1 #import('dart:dom'); |
| 2 #import('dart:json'); | 2 #import('dart:json'); |
| 3 #import('Suites.dart'); | 3 #import('Suites.dart'); |
| 4 | 4 |
| 5 main() { | 5 main() { |
| 6 window.onload = (Event evt) { | 6 window.onload = (Event evt) { |
| 7 new Dromaeo().run(); | 7 new Dromaeo().run(); |
| 8 }; | 8 }; |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 div.setAttribute('class', clazz); | 83 div.setAttribute('class', clazz); |
| 84 return div; | 84 return div; |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 class Dromaeo { | 88 class Dromaeo { |
| 89 final List<SuiteController> _suiteControllers; | 89 final List<SuiteController> _suiteControllers; |
| 90 Function _handler; | 90 Function _handler; |
| 91 | 91 |
| 92 Dromaeo() | 92 Dromaeo() |
| 93 : _suiteControllers = new List<SuiteController>(), | 93 : _suiteControllers = new List<SuiteController>() |
| 94 _handler = _createHandler() | |
| 95 { | 94 { |
| 95 _handler = _createHandler(); |
| 96 window.addEventListener( | 96 window.addEventListener( |
| 97 'message', | 97 'message', |
| 98 (MessageEvent event) { | 98 (MessageEvent event) { |
| 99 try { | 99 try { |
| 100 final response = JSON.parse(event.data); | 100 final response = JSON.parse(event.data); |
| 101 _handler = _handler(response['command'], response['data']); | 101 _handler = _handler(response['command'], response['data']); |
| 102 } catch (final e, final stacktrace) { | 102 } catch (final e, final stacktrace) { |
| 103 window.alert('Exception: ${e}: ${stacktrace}'); | 103 window.alert('Exception: ${e}: ${stacktrace}'); |
| 104 } | 104 } |
| 105 }, | 105 }, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 199 } |
| 200 | 200 |
| 201 HTMLElement _byId(String id) { | 201 HTMLElement _byId(String id) { |
| 202 return document.getElementById(id); | 202 return document.getElementById(id); |
| 203 } | 203 } |
| 204 | 204 |
| 205 int get _suitesTotal() { | 205 int get _suitesTotal() { |
| 206 return _suiteControllers.length; | 206 return _suiteControllers.length; |
| 207 } | 207 } |
| 208 } | 208 } |
| OLD | NEW |