| 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 part of app; | 5 part of app; |
| 6 | 6 |
| 7 /// The LocationManager class observes and parses the hash ('#') portion of the | 7 /// The LocationManager class observes and parses the hash ('#') portion of the |
| 8 /// URL in window.location. The text after the '#' is used as the request | 8 /// URL in window.location. The text after the '#' is used as the request |
| 9 /// string for the VM service. | 9 /// string for the VM service. |
| 10 class LocationManager extends Observable { | 10 class LocationManager extends Observable { |
| 11 static const String defaultHash = '#/isolates/'; | 11 static const String defaultHash = '#/isolates/'; |
| 12 static final RegExp _currentIsolateMatcher = new RegExp(r'#/isolates/\d+'); | 12 static final RegExp _currentIsolateMatcher = new RegExp(r'#/isolates/\d+'); |
| 13 static final RegExp _currentObjectMatcher = new RegExp(r'#/isolates/\d+/'); | 13 static final RegExp _currentObjectMatcher = new RegExp(r'#/isolates/\d+(/|$)')
; |
| 14 ObservatoryApplication _app; | 14 ObservatoryApplication _app; |
| 15 @observable String currentHash = ''; | 15 @observable String currentHash = ''; |
| 16 | 16 |
| 17 void init() { | 17 void init() { |
| 18 window.onHashChange.listen((event) { | 18 window.onHashChange.listen((event) { |
| 19 if (setDefaultHash()) { | 19 if (setDefaultHash()) { |
| 20 // We just triggered another onHashChange event. | 20 // We just triggered another onHashChange event. |
| 21 return; | 21 return; |
| 22 } | 22 } |
| 23 // Request the current anchor. | 23 // Request the current anchor. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 if (_app.isolate == null) { | 80 if (_app.isolate == null) { |
| 81 // No current isolate, refresh the isolate list. | 81 // No current isolate, refresh the isolate list. |
| 82 _app.vm.isolates.reload().then(_setResponse); | 82 _app.vm.isolates.reload().then(_setResponse); |
| 83 return; | 83 return; |
| 84 } | 84 } |
| 85 // Have a current isolate, request object. | 85 // Have a current isolate, request object. |
| 86 var objectId = currentIsolateObjectId(); | 86 var objectId = currentIsolateObjectId(); |
| 87 _app.isolate.get(objectId).then(_setResponse); | 87 _app.isolate.get(objectId).then(_setResponse); |
| 88 } | 88 } |
| 89 } | 89 } |
| OLD | NEW |