design: simplified view interfaces
This commit is contained in:
@ -11,12 +11,11 @@ export class ChangeDetection {
|
||||
detectChanges():int {
|
||||
var current:Record = _rootWatchGroup._headRecord;
|
||||
var count:number = 0;
|
||||
while(current != null) {
|
||||
if(current.check()) {
|
||||
while (current != null) {
|
||||
if (current.check()) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
|
3
modules/change_detection/src/facade.dart
Normal file
3
modules/change_detection/src/facade.dart
Normal file
@ -0,0 +1,3 @@
|
||||
library change_detection.facade;
|
||||
|
||||
typedef SetterFn(Object obj, value);
|
1
modules/change_detection/src/facade.es6
Normal file
1
modules/change_detection/src/facade.es6
Normal file
@ -0,0 +1 @@
|
||||
export var SetterFn = Function;
|
@ -23,8 +23,8 @@ export class ProtoRecord {
|
||||
constructor(watchGroup:ProtoWatchGroup, fieldName:String) {
|
||||
this.watchGroup = watchGroup;
|
||||
this.fieldName = fieldName;
|
||||
this._next = null;
|
||||
this._prev = null;
|
||||
this.next = null;
|
||||
this.prev = null;
|
||||
this._checkNext = null;
|
||||
this._checkPrev = null;
|
||||
this._notifierNext = null;
|
||||
@ -36,17 +36,17 @@ export class ProtoRecord {
|
||||
|
||||
instantiate(watchGroup:WatchGroup):Record {
|
||||
var record = this._clone = new Record(watchGroup, this);
|
||||
record._prev = this._prev._clone;
|
||||
record.prev = this.prev._clone;
|
||||
record._checkPrev = this._checkPrev._clone;
|
||||
return _clone;
|
||||
}
|
||||
|
||||
instantiateComplete():Record {
|
||||
var record = this._clone;
|
||||
record._next = this._next._clone;
|
||||
record.next = this.next._clone;
|
||||
record._checkNext = this._checkNext._clone;
|
||||
this._clone = null;
|
||||
return this._next;
|
||||
return this.next;
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,8 +97,8 @@ export class Record {
|
||||
constructor(watchGroup:WatchGroup, protoRecord:ProtoRecord) {
|
||||
this.protoRecord = protoRecord;
|
||||
this.watchGroup = watchGroup;
|
||||
this._next = null;
|
||||
this._prev = null;
|
||||
this.next = null;
|
||||
this.prev = null;
|
||||
this._checkNext = null;
|
||||
this._checkPrev = null;
|
||||
this._notifierNext = null;
|
||||
|
@ -1,5 +1,4 @@
|
||||
import {ProtoRecord, Record} from './record';
|
||||
import {WatchGroupDispatcher} from './watch_group_dispatcher';
|
||||
|
||||
export class ProtoWatchGroup {
|
||||
@FIELD('final _headRecord:ProtoRecord')
|
||||
@ -31,7 +30,8 @@ export class ProtoWatchGroup {
|
||||
|
||||
proto = this._headRecord;
|
||||
while(proto != null) {
|
||||
proto = proto.instantiateComplete();
|
||||
proto.instantiateComplete();
|
||||
proto = proto.next;
|
||||
}
|
||||
|
||||
watchGroup._headRecord = head;
|
||||
@ -61,3 +61,7 @@ export class WatchGroup {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class WatchGroupDispatcher {
|
||||
onRecordChange(record:Record, context) {}
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
import {Record} from './record';
|
||||
|
||||
export class WatchGroupDispatcher {
|
||||
onRecordChange(record:Record, context) {}
|
||||
}
|
Reference in New Issue
Block a user