| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library script_ref_element; |
| 6 |
| 7 import 'package:polymer/polymer.dart'; |
| 8 import 'observatory_element.dart'; |
| 9 |
| 10 @CustomTag('script-ref') |
| 11 class ScriptRefElement extends ObservatoryElement { |
| 12 @published Map ref; |
| 13 // TODO(johnmccutchan): Remove scriptURL once Frame objects provide a proper |
| 14 // script reference. |
| 15 @published String scriptURL = ''; |
| 16 ScriptRefElement.created() : super.created(); |
| 17 |
| 18 void refChanged(oldValue) { |
| 19 notifyPropertyChange(#url, "", url); |
| 20 notifyPropertyChange(#name, [], name); |
| 21 } |
| 22 |
| 23 void scriptURLChanged(oldValue) { |
| 24 notifyPropertyChange(#url, "", url); |
| 25 notifyPropertyChange(#name, [], name); |
| 26 } |
| 27 |
| 28 String get url { |
| 29 if (app != null && ref != null) { |
| 30 return app.locationManager.currentIsolateRelativeLink(ref['id']); |
| 31 } else if (app != null) { |
| 32 return app.locationManager.currentIsolateScriptLink(scriptURL); |
| 33 } |
| 34 return ''; |
| 35 } |
| 36 |
| 37 String get name { |
| 38 return ref != null ? ref['name'] : scriptURL; |
| 39 } |
| 40 } |
| OLD | NEW |