Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Unified Diff: pkg/observe/lib/html.dart

Issue 27618002: package:observe fix various api issues (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/mdv/test/template_element_test.dart ('k') | pkg/observe/lib/observe.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/observe/lib/html.dart
diff --git a/pkg/observe/lib/html.dart b/pkg/observe/lib/html.dart
index 4ba0154085c9707ee8f6fcdac9b6b9981e1ac483..abf333a4abba170f7954274825eb694ad1248c06 100644
--- a/pkg/observe/lib/html.dart
+++ b/pkg/observe/lib/html.dart
@@ -16,7 +16,9 @@ import 'observe.dart';
/** An observable version of [window.location.hash]. */
final ObservableLocationHash windowLocation = new ObservableLocationHash._();
-class ObservableLocationHash extends ChangeNotifierBase {
+class ObservableLocationHash extends ChangeNotifier {
+ Object _currentHash;
+
ObservableLocationHash._() {
// listen on changes to #hash in the URL
// Note: listen on both popState and hashChange, because IE9 doesn't support
@@ -25,6 +27,8 @@ class ObservableLocationHash extends ChangeNotifierBase {
// changes.
window.onHashChange.listen(_notifyHashChange);
window.onPopState.listen(_notifyHashChange);
+
+ _currentHash = hash;
}
@reflectable String get hash => window.location.hash;
@@ -41,7 +45,9 @@ class ObservableLocationHash extends ChangeNotifierBase {
}
void _notifyHashChange(_) {
- notifyChange(new PropertyChangeRecord(#hash));
+ var oldValue = _currentHash;
+ _currentHash = hash;
+ notifyPropertyChange(#hash, oldValue, _currentHash);
}
}
« no previous file with comments | « pkg/mdv/test/template_element_test.dart ('k') | pkg/observe/lib/observe.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698