| 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 observatory_element; | 5 library observatory_element; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'package:observatory/app.dart'; | 9 import 'package:observatory/app.dart'; |
| 10 import 'package:polymer/polymer.dart'; | 10 import 'package:polymer/polymer.dart'; |
| 11 | 11 |
| 12 /// Base class for all Observatory custom elements. | 12 /// Base class for all Observatory custom elements. |
| 13 @CustomTag('observatory-element') | 13 @CustomTag('observatory-element') |
| 14 class ObservatoryElement extends PolymerElement { | 14 class ObservatoryElement extends PolymerElement { |
| 15 ObservatoryElement.created() : super.created(); | 15 ObservatoryElement.created() : super.created(); |
| 16 | 16 |
| 17 ObservatoryApplication get app => ObservatoryApplication.app; | 17 ObservatoryApplication get app => ObservatoryApplication.app; |
| 18 Page get page => app.currentPage; |
| 19 ObservableMap get args => page.args; |
| 18 | 20 |
| 19 @override | 21 @override |
| 20 void attached() { | 22 void attached() { |
| 21 super.attached(); | 23 super.attached(); |
| 22 _startPoll(); | 24 _startPoll(); |
| 23 } | 25 } |
| 24 | 26 |
| 25 @override | 27 @override |
| 26 void attributeChanged(String name, var oldValue, var newValue) { | 28 void attributeChanged(String name, var oldValue, var newValue) { |
| 27 super.attributeChanged(name, oldValue, newValue); | 29 super.attributeChanged(name, oldValue, newValue); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 103 |
| 102 | 104 |
| 103 String formatSize(int bytes) => Utils.formatSize(bytes); | 105 String formatSize(int bytes) => Utils.formatSize(bytes); |
| 104 | 106 |
| 105 String fileAndLine(Map frame) { | 107 String fileAndLine(Map frame) { |
| 106 var file = frame['script']['user_name']; | 108 var file = frame['script']['user_name']; |
| 107 var shortFile = file.substring(file.lastIndexOf('/') + 1); | 109 var shortFile = file.substring(file.lastIndexOf('/') + 1); |
| 108 return "${shortFile}:${frame['line']}"; | 110 return "${shortFile}:${frame['line']}"; |
| 109 } | 111 } |
| 110 | 112 |
| 113 int parseInt(String value) => int.parse(value); |
| 114 |
| 111 bool isNull(String type) { | 115 bool isNull(String type) { |
| 112 return type == 'Null'; | 116 return type == 'Null'; |
| 113 } | 117 } |
| 114 | 118 |
| 115 bool isError(String type) { | 119 bool isError(String type) { |
| 116 return type == 'Error'; | 120 return type == 'Error'; |
| 117 } | 121 } |
| 118 | 122 |
| 119 bool isInt(String type) { | 123 bool isInt(String type) { |
| 120 return (type == 'Smi' || | 124 return (type == 'Smi' || |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 'Bool', | 159 'Bool', |
| 156 'String', | 160 'String', |
| 157 'Double', | 161 'Double', |
| 158 'Instance', | 162 'Instance', |
| 159 'GrowableObjectArray', | 163 'GrowableObjectArray', |
| 160 'Array', | 164 'Array', |
| 161 'Type', | 165 'Type', |
| 162 'Error'].contains(type)); | 166 'Error'].contains(type)); |
| 163 } | 167 } |
| 164 } | 168 } |
| OLD | NEW |