design: simplified view interfaces

This commit is contained in:
Misko Hevery
2014-09-28 16:29:11 -07:00
parent 39c03e67e6
commit 9c7c7e8acf
16 changed files with 149 additions and 104 deletions

View File

@ -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;
}
}

View File

@ -0,0 +1,3 @@
library change_detection.facade;
typedef SetterFn(Object obj, value);

View File

@ -0,0 +1 @@
export var SetterFn = Function;

View File

@ -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;

View File

@ -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) {}
}

View File

@ -1,5 +0,0 @@
import {Record} from './record';
export class WatchGroupDispatcher {
onRecordChange(record:Record, context) {}
}