| 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 json_view_element; | 5 library json_view_element; |
| 6 | 6 |
| 7 import 'package:polymer/polymer.dart'; | 7 import 'package:polymer/polymer.dart'; |
| 8 import 'observatory_element.dart'; | 8 import 'observatory_element.dart'; |
| 9 | 9 |
| 10 @CustomTag('json-view') | 10 @CustomTag('json-view') |
| 11 class JsonViewElement extends ObservatoryElement { | 11 class JsonViewElement extends ObservatoryElement { |
| 12 @published dynamic get json => __$json; dynamic __$json = null; set json(dynam
ic value) { __$json = notifyPropertyChange(#json, __$json, value); } | 12 @published var json = null; |
| 13 var _count = 0; | 13 var _count = 0; |
| 14 | 14 |
| 15 JsonViewElement() : super() { | 15 JsonViewElement.created() : super.created(); |
| 16 |
| 17 void enteredView() { |
| 18 super.enteredView(); |
| 19 _count = 0; |
| 16 } | 20 } |
| 17 | 21 |
| 18 void jsonChanged(oldValue) { | 22 void jsonChanged(oldValue) { |
| 19 this.notifyPropertyChange(#valueType, null, null); | 23 notifyPropertyChange(#valueType, "a", "b"); |
| 20 } | 24 } |
| 21 | 25 |
| 22 String get primitiveString { | 26 String get primitiveString { |
| 23 return json.toString(); | 27 return json.toString(); |
| 24 } | 28 } |
| 25 | 29 |
| 26 String get valueType { | 30 String get valueType { |
| 27 if (json is Map) { | 31 if (json is Map) { |
| 28 return 'Map'; | 32 return 'Map'; |
| 29 } else if (json is List) { | 33 } else if (json is List) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 47 if (json is Map) { | 51 if (json is Map) { |
| 48 return json.keys.toList(); | 52 return json.keys.toList(); |
| 49 } | 53 } |
| 50 return []; | 54 return []; |
| 51 } | 55 } |
| 52 | 56 |
| 53 dynamic value(String key) { | 57 dynamic value(String key) { |
| 54 return json[key]; | 58 return json[key]; |
| 55 } | 59 } |
| 56 } | 60 } |
| OLD | NEW |