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

Side by Side Diff: lib/html.dart

Issue 1616953004: Fixed strong mode errors and warnings reachable from lib/observe.dart (Closed) Base URL: https://github.com/dart-lang/observe.git@master
Patch Set: Removed inferrable type param Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « benchmark/index.dart ('k') | lib/mirrors_used.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // TODO(jmesserly): can we handle this more elegantly? 5 // TODO(jmesserly): can we handle this more elegantly?
6 // In general, it seems like we want a convenient way to take a Stream plus a 6 // In general, it seems like we want a convenient way to take a Stream plus a
7 // getter and convert this into an Observable. 7 // getter and convert this into an Observable.
8 8
9 /// Helpers for exposing dart:html as observable data. 9 /// Helpers for exposing dart:html as observable data.
10 library observe.html; 10 library observe.html;
(...skipping 24 matching lines...) Expand all
35 35
36 /// Pushes a new URL state, similar to the affect of clicking a link. 36 /// Pushes a new URL state, similar to the affect of clicking a link.
37 /// Has no effect if the [value] already equals [window.location.hash]. 37 /// Has no effect if the [value] already equals [window.location.hash].
38 @reflectable void set hash(String value) { 38 @reflectable void set hash(String value) {
39 if (value == hash) return; 39 if (value == hash) return;
40 40
41 window.history.pushState(null, '', value); 41 window.history.pushState(null, '', value);
42 _notifyHashChange(null); 42 _notifyHashChange(null);
43 } 43 }
44 44
45 void _notifyHashChange(_) { 45 void _notifyHashChange(Event _) {
46 var oldValue = _currentHash; 46 var oldValue = _currentHash;
47 _currentHash = hash; 47 _currentHash = hash;
48 notifyPropertyChange(#hash, oldValue, _currentHash); 48 notifyPropertyChange(#hash, oldValue, _currentHash);
49 } 49 }
50 } 50 }
51 51
52 /// *Deprecated* use [CssClassSet.toggle] instead. 52 /// *Deprecated* use [CssClassSet.toggle] instead.
53 /// 53 ///
54 /// Add or remove CSS class [className] based on the [value]. 54 /// Add or remove CSS class [className] based on the [value].
55 @deprecated 55 @deprecated
56 void updateCssClass(Element element, String className, bool value) { 56 void updateCssClass(Element element, String className, bool value) {
57 if (value == true) { 57 if (value == true) {
58 element.classes.add(className); 58 element.classes.add(className);
59 } else { 59 } else {
60 element.classes.remove(className); 60 element.classes.remove(className);
61 } 61 }
62 } 62 }
63 63
64 /// *Deprecated* use `class="{{ binding }}"` in your HTML instead. It will also 64 /// *Deprecated* use `class="{{ binding }}"` in your HTML instead. It will also
65 /// work on a `<polymer-element>`. 65 /// work on a `<polymer-element>`.
66 /// 66 ///
67 /// Bind a CSS class to the observable [object] and property [path]. 67 /// Bind a CSS class to the observable [object] and property [path].
68 @deprecated 68 @deprecated
69 PathObserver bindCssClass(Element element, String className, 69 PathObserver bindCssClass(
70 Observable object, String path) { 70 Element element, String className, Observable object, String path) {
71
72 callback(value) { 71 callback(value) {
73 updateCssClass(element, className, value); 72 updateCssClass(element, className, value);
74 } 73 }
75 74
76 var obs = new PathObserver(object, path); 75 var obs = new PathObserver(object, path);
77 callback(obs.open(callback)); 76 callback(obs.open(callback));
78 return obs; 77 return obs;
79 } 78 }
OLDNEW
« no previous file with comments | « benchmark/index.dart ('k') | lib/mirrors_used.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698