angular-cn/modules/change_detection/src/change_detector.js

27 lines
662 B
JavaScript
Raw Normal View History

import {ProtoWatchGroup, WatchGroup} from './watch_group';
import {ProtoRecord, Record} from './record';
import {FIELD, int} from 'facade/lang';
export * from './record';
export * from './watch_group'
export class ChangeDetector {
@FIELD('final _rootWatchGroup:WatchGroup')
constructor(watchGroup:WatchGroup) {
this._rootWatchGroup = watchGroup;
}
detectChanges():int {
var record:Record = this._rootWatchGroup.headRecord;
var count:int = 0;
for (record = this._rootWatchGroup.headRecord;
record != null;
record = record.checkNext) {
if (record.check()) {
count++;
}
}
return count;
}
}