69 lines
1.6 KiB
JavaScript
Raw Normal View History

2014-09-26 11:20:08 -07:00
import {ProtoRecord, Record} from './record';
import {FIELD} from 'facade/lang';
2014-09-26 11:20:08 -07:00
export class ProtoWatchGroup {
@FIELD('final _headRecord:ProtoRecord')
@FIELD('final _tailRecord:ProtoRecord')
constructor() {
this._headRecord = null;
this._tailRecord = null;
}
watch(
expression:String,
context,
{isCollection})
{
/// IMPREMENT
}
instantiate(dispatcher:WatchGroupDispatcher):WatchGroup {
var watchGroup:WatchGroup = new WatchGroup(this, dispatcher);
var head:Record = null;
var tail:Record = null;
var proto:ProtoRecord = this._headRecord;
while(proto != null) {
tail = proto.instantiate(watchGroup);
if (head == null) head = tail;
proto = proto.next;
}
proto = this._headRecord;
while(proto != null) {
2014-09-28 16:29:11 -07:00
proto.instantiateComplete();
proto = proto.next;
2014-09-26 11:20:08 -07:00
}
watchGroup._headRecord = head;
watchGroup._tailRecord = tail;
return watchGroup;
}
}
export class WatchGroup {
2014-09-26 11:20:08 -07:00
@FIELD('final protoWatchGroup:ProtoWatchGroup')
@FIELD('final dispatcher:WatchGroupDispatcher')
2014-09-26 11:20:08 -07:00
@FIELD('final _headRecord:Record')
@FIELD('final _tailRecord:Record')
constructor(protoWatchGroup:ProtoWatchGroup, dispatcher:WatchGroupDispatcher) {
this.protoWatchGroup = protoWatchGroup;
this.dispatcher = dispatcher;
this._headRecord = null;
this._tailRecord = null;
}
insertChildGroup(newChild:WatchGroup, insertAfter:WatchGroup) {
/// IMPLEMENT
}
remove() {
/// IMPLEMENT
}
}
2014-09-28 16:29:11 -07:00
export class WatchGroupDispatcher {
onRecordChange(record:Record, context) {}
}