Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit b7085e7

Browse files
EisenbergEffectcaitp
authored andcommitted
refactor(watch_group): merge DCCDGroup and WatchGroup
Now that the new observer functionality has been added, we no longer need a strict separation between watch groups and dirty checking groups. This commit merges those two together.
1 parent fa1610c commit b7085e7

File tree

5 files changed

+415
-230
lines changed

5 files changed

+415
-230
lines changed

src/dirty_checking.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ export class DirtyCheckingChangeDetectorGroup {
128128
}
129129
return (root instanceof DirtyCheckingChangeDetector) ? root : null;
130130
}
131+
get _rootGroup(){
132+
return this._root;
133+
}
131134
get _childInclRecordTail() {
132135
var tail = this, nextTail;
133136
while ((nextTail = tail._childTail) !== null) {
@@ -252,7 +255,7 @@ export class DirtyCheckingChangeDetector extends DirtyCheckingChangeDetectorGrou
252255
}
253256
}
254257

255-
class ChangeIterator {
258+
export class ChangeIterator {
256259
constructor(next) {
257260
this._current = null;
258261
this._next = next;
@@ -278,7 +281,7 @@ class ChangeIterator {
278281
}
279282
}
280283

281-
class DirtyCheckingRecord {
284+
export class DirtyCheckingRecord {
282285
constructor(group, object, fieldName, getter, handler) {
283286
this._group = group;
284287
this._getter = getter;
@@ -289,11 +292,17 @@ class DirtyCheckingRecord {
289292
this.object = object;
290293
this._nextRecord = this._prevRecord = this._nextChange = null;
291294
}
295+
292296
static marker() {
293297
var record = new DirtyCheckingRecord(null, null, null, null, null);
294298
record._mode = _MODE_MARKER_;
295299
return record;
296300
}
301+
302+
get isMarker(){
303+
return this._mode == _MODE_MARKER_;
304+
}
305+
297306
get nextChange() {
298307
return this._nextChange;
299308
}
@@ -346,7 +355,7 @@ class DirtyCheckingRecord {
346355
return;
347356
}
348357

349-
this._observer = this._group && this._group._root.getObserver(obj, this._field);
358+
this._observer = this._group && this._group._rootGroup.getObserver(obj, this._field);
350359

351360
if(this._observer){
352361
this._mode = _NOTIFIED_;

0 commit comments

Comments
 (0)