| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Client component to display [GlobalResult]s as a web app. | 5 /// Client component to display [GlobalResult]s as a web app. |
| 6 library dart2js_info.bin.inference.client; | 6 library dart2js_info.bin.inference.client; |
| 7 | 7 |
| 8 import 'dart:html' hide Entry; | 8 import 'dart:html' hide Entry; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'package:dart2js_info/info.dart'; | 10 import 'package:dart2js_info/info.dart'; |
| 11 import 'package:dart2js_info/src/string_edit_buffer.dart'; | 11 import 'package:dart2js_info/src/string_edit_buffer.dart'; |
| 12 import 'package:charcode/charcode.dart'; | 12 import 'package:charcode/charcode.dart'; |
| 13 | 13 |
| 14 AllInfo data; | 14 AllInfo data; |
| 15 main() async { | 15 main() async { |
| 16 data = | 16 data = |
| 17 AllInfo.parseFromJson(JSON.decode(await HttpRequest.getString('/data'))); | 17 new AllInfo.fromJson(JSON.decode(await HttpRequest.getString('/data'))); |
| 18 | 18 |
| 19 routeByHash(); | 19 routeByHash(); |
| 20 window.onHashChange.listen((_) => routeByHash()); | 20 window.onHashChange.listen((_) => routeByHash()); |
| 21 } | 21 } |
| 22 | 22 |
| 23 /// Does basic routing for the client UI. | 23 /// Does basic routing for the client UI. |
| 24 routeByHash() { | 24 routeByHash() { |
| 25 var hash = window.location.hash; | 25 var hash = window.location.hash; |
| 26 if (hash.isEmpty || hash == '#' || hash == '#!') { | 26 if (hash.isEmpty || hash == '#' || hash == '#!') { |
| 27 handleHomePage(); | 27 handleHomePage(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 for (var entry in entries[metric]) { | 125 for (var entry in entries[metric]) { |
| 126 code.insert(entry.begin, '<span class="send ${cssClassName} inactive">', | 126 code.insert(entry.begin, '<span class="send ${cssClassName} inactive">', |
| 127 -entry.end); | 127 -entry.end); |
| 128 code.insert(entry.end, '</span>'); | 128 code.insert(entry.end, '</span>'); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 _classNameForMetric(Metric metric) => metric.name.replaceAll(' ', '-'); | 134 _classNameForMetric(Metric metric) => metric.name.replaceAll(' ', '-'); |
| OLD | NEW |