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 library observe.src.path_observer; | 5 library observe.src.path_observer; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:math' show min; | 9 import 'dart:math' show min; |
10 @MirrorsUsed(metaTargets: const [Reflectable, ObservableProperty], | 10 @MirrorsUsed(metaTargets: const [Reflectable, ObservableProperty], |
11 override: 'smoke.mirrors') | 11 override: 'smoke.mirrors') |
12 import 'dart:mirrors' show MirrorsUsed; | 12 import 'dart:mirrors' show MirrorsUsed; |
13 | 13 |
14 import 'package:logging/logging.dart' show Logger, Level; | 14 import 'package:logging/logging.dart' show Logger, Level; |
15 import 'package:observe/observe.dart'; | 15 import 'package:observe/observe.dart'; |
16 import 'package:observe/src/observable.dart' show objectType; | |
17 import 'package:smoke/smoke.dart' as smoke; | 16 import 'package:smoke/smoke.dart' as smoke; |
18 | 17 |
19 /// A data-bound path starting from a view-model or model object, for example | 18 /// A data-bound path starting from a view-model or model object, for example |
20 /// `foo.bar.baz`. | 19 /// `foo.bar.baz`. |
21 /// | 20 /// |
22 /// When [open] is called, this will observe changes to the object and any | 21 /// When [open] is called, this will observe changes to the object and any |
23 /// intermediate object along the path, and send updated values accordingly. | 22 /// intermediate object along the path, and send updated values accordingly. |
24 /// When [close] is called it will stop observing the objects. | 23 /// When [close] is called it will stop observing the objects. |
25 /// | 24 /// |
26 /// This class is used to implement `Node.bind` and similar functionality in | 25 /// This class is used to implement `Node.bind` and similar functionality in |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 for (var observer in _observers.values.toList(growable: false)) { | 655 for (var observer in _observers.values.toList(growable: false)) { |
657 if (observer._isOpen) observer._check(); | 656 if (observer._isOpen) observer._check(); |
658 } | 657 } |
659 | 658 |
660 _resetNeeded = true; | 659 _resetNeeded = true; |
661 scheduleMicrotask(reset); | 660 scheduleMicrotask(reset); |
662 } | 661 } |
663 } | 662 } |
664 | 663 |
665 const int _MAX_DIRTY_CHECK_CYCLES = 1000; | 664 const int _MAX_DIRTY_CHECK_CYCLES = 1000; |
OLD | NEW |