| 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 observe; | 5 part of observe; | 
| 6 | 6 | 
| 7 /** | 7 /** | 
| 8  * Represents an object with observable properties. This is used by data in | 8  * Represents an object with observable properties. This is used by data in | 
| 9  * model-view architectures to notify interested parties of [changes] to the | 9  * model-view architectures to notify interested parties of [changes] to the | 
| 10  * object's properties (fields or getter/setter pairs). | 10  * object's properties (fields or getter/setter pairs). | 
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 164    *   [Observable.dirtyCheck] instead. | 164    *   [Observable.dirtyCheck] instead. | 
| 165    */ | 165    */ | 
| 166   void notifyChange(ChangeRecord record) { | 166   void notifyChange(ChangeRecord record) { | 
| 167     if (!hasObservers) return; | 167     if (!hasObservers) return; | 
| 168 | 168 | 
| 169     if (_records == null) _records = []; | 169     if (_records == null) _records = []; | 
| 170     _records.add(record); | 170     _records.add(record); | 
| 171   } | 171   } | 
| 172 } | 172 } | 
| 173 | 173 | 
| 174 /** |  | 
| 175  * *Deprecated* use [Observable.notifyPropertyChange] instead. |  | 
| 176  * |  | 
| 177  * This API should not be used as it creates a |  | 
| 178  * [PropertyChangeRecord] without oldValue and newValue. |  | 
| 179  * |  | 
| 180  * Notify the property change. Shorthand for: |  | 
| 181  * |  | 
| 182  *     target.notifyChange(new PropertyChangeRecord(target, name, null, null)); |  | 
| 183  */ |  | 
| 184 @deprecated |  | 
| 185 void notifyProperty(Observable target, Symbol name) { |  | 
| 186   target.notifyChange(new PropertyChangeRecord(target, name, null, null)); |  | 
| 187 } |  | 
| 188 |  | 
| 189 // TODO(jmesserly): remove the instance method and make this top-level method | 174 // TODO(jmesserly): remove the instance method and make this top-level method | 
| 190 // public instead? | 175 // public instead? | 
| 191 _notifyPropertyChange(Observable obj, Symbol field, Object oldValue, | 176 _notifyPropertyChange(Observable obj, Symbol field, Object oldValue, | 
| 192     Object newValue) { | 177     Object newValue) { | 
| 193 | 178 | 
| 194   if (obj.hasObservers && oldValue != newValue) { | 179   if (obj.hasObservers && oldValue != newValue) { | 
| 195     obj.notifyChange(new PropertyChangeRecord(obj, field, oldValue, newValue)); | 180     obj.notifyChange(new PropertyChangeRecord(obj, field, oldValue, newValue)); | 
| 196   } | 181   } | 
| 197   return newValue; | 182   return newValue; | 
| 198 } | 183 } | 
| OLD | NEW | 
|---|