design: add changed detection API

This commit is contained in:
Misko Hevery
2014-09-26 11:20:08 -07:00
parent 7e3005e705
commit 6335fc407c
10 changed files with 195 additions and 71 deletions

View File

@ -6,6 +6,7 @@ export * from './annotations/component';
export * from './annotations/template_config';
export * from 'change_detection/change_detection';
export * from 'change_detection/watch_group';
export * from 'change_detection/record';
export * from './compiler/compiler';

View File

@ -1,5 +1,6 @@
import {Node, DocumentFragment} from 'facade/dom';
import {ListWrapper wraps List} from 'facade/collection';
import {WatchGroupDispatcher} from 'change_detection/watch_group_dispatcher';
import {Record} from 'change_detection/record';
@IMPLEMENTS(WatchGroupDispatcher)
@ -18,17 +19,17 @@ export class View {
this._nodes = ListWrapper.clone(fragment.childNodes);
}
notify(record:Record, target) {
/*
onRecordChange(record:Record, target) {
// dispatch to element injector or text nodes based on context
if (Number.is(target)) {
// we know it refferst to _textNodes.
} else {
if (target is ElementInjectorTarge) {
// we know that it is ElementInjectorTarge
var eTarget:ElementInjectorTarget = target;
onChangeDispatcher.notify(this, eTarget);
eTarget.invoke(record, _elementInjectors);
} else {
// we know it refferst to _textNodes.
var textNodeIndex:number = target;
DOM.setText(this._textNodes[textNodeIndex], record.currentValue);
}
*/
}
}