style(Change Detection): rename WatchGroupDispatcher to ChangeDispatcher
This commit is contained in:
parent
01fa90c11d
commit
c362f33fe4
@ -8,7 +8,7 @@ import {benchmark, benchmarkStep} from 'benchpress/benchpress';
|
|||||||
import {
|
import {
|
||||||
ChangeDetector,
|
ChangeDetector,
|
||||||
ProtoRecordRange,
|
ProtoRecordRange,
|
||||||
WatchGroupDispatcher,
|
ChangeDispatcher,
|
||||||
} from 'change_detection/change_detector';
|
} from 'change_detection/change_detector';
|
||||||
|
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ export function main () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class DummyDispatcher extends WatchGroupDispatcher {
|
class DummyDispatcher extends ChangeDispatcher {
|
||||||
onRecordChange(record, context) {
|
onRecordChange(record, context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ export class Record {
|
|||||||
|
|
||||||
// Opaque data which will be the target of notification.
|
// Opaque data which will be the target of notification.
|
||||||
// If the object is instance of Record, then it it is directly processed
|
// If the object is instance of Record, then it it is directly processed
|
||||||
// Otherwise it is the context used by WatchGroupDispatcher.
|
// Otherwise it is the context used by ChangeDispatcher.
|
||||||
dest;
|
dest;
|
||||||
|
|
||||||
constructor(recordRange:RecordRange, protoRecord:ProtoRecord, formatters:Map) {
|
constructor(recordRange:RecordRange, protoRecord:ProtoRecord, formatters:Map) {
|
||||||
|
@ -45,9 +45,10 @@ export class ProtoRecordRange {
|
|||||||
* Parses [ast] into [ProtoRecord]s and adds them to [ProtoRecordRange].
|
* Parses [ast] into [ProtoRecord]s and adds them to [ProtoRecordRange].
|
||||||
*
|
*
|
||||||
* @param ast The expression to watch
|
* @param ast The expression to watch
|
||||||
* @param expressionMemento an opaque object which will be passed to WatchGroupDispatcher on
|
* @param expressionMemento an opaque object which will be passed to ChangeDispatcher on
|
||||||
* detecting a change.
|
* detecting a change.
|
||||||
* @param content Wether to watch collection content (true) or reference (false, default)
|
* @param groupMemento
|
||||||
|
* @param content Whether to watch collection content (true) or reference (false, default)
|
||||||
*/
|
*/
|
||||||
addRecordsFromAST(ast:AST,
|
addRecordsFromAST(ast:AST,
|
||||||
expressionMemento,
|
expressionMemento,
|
||||||
@ -65,7 +66,7 @@ export class ProtoRecordRange {
|
|||||||
this.recordCreator.createRecordsFromAST(ast, expressionMemento, groupMemento);
|
this.recordCreator.createRecordsFromAST(ast, expressionMemento, groupMemento);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(rado): the type annotation should be dispatcher:WatchGroupDispatcher.
|
// TODO(rado): the type annotation should be dispatcher:ChangeDispatcher.
|
||||||
// but @Implements is not ready yet.
|
// but @Implements is not ready yet.
|
||||||
instantiate(dispatcher, formatters:Map):RecordRange {
|
instantiate(dispatcher, formatters:Map):RecordRange {
|
||||||
var recordRange:RecordRange = new RecordRange(this, dispatcher);
|
var recordRange:RecordRange = new RecordRange(this, dispatcher);
|
||||||
@ -98,11 +99,11 @@ export class ProtoRecordRange {
|
|||||||
|
|
||||||
export class RecordRange {
|
export class RecordRange {
|
||||||
protoRecordRange:ProtoRecordRange;
|
protoRecordRange:ProtoRecordRange;
|
||||||
dispatcher:any; //WatchGroupDispatcher
|
dispatcher:any; //ChangeDispatcher
|
||||||
headRecord:Record;
|
headRecord:Record;
|
||||||
tailRecord:Record;
|
tailRecord:Record;
|
||||||
disabled:boolean;
|
disabled:boolean;
|
||||||
// TODO(rado): the type annotation should be dispatcher:WatchGroupDispatcher.
|
// TODO(rado): the type annotation should be dispatcher:ChangeDispatcher.
|
||||||
// but @Implements is not ready yet.
|
// but @Implements is not ready yet.
|
||||||
constructor(protoRecordRange:ProtoRecordRange, dispatcher) {
|
constructor(protoRecordRange:ProtoRecordRange, dispatcher) {
|
||||||
this.protoRecordRange = protoRecordRange;
|
this.protoRecordRange = protoRecordRange;
|
||||||
@ -296,8 +297,7 @@ function _linkEnabled(a:Record, b:Record) {
|
|||||||
b.prevEnabled = a;
|
b.prevEnabled = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class WatchGroupDispatcher {
|
export class ChangeDispatcher {
|
||||||
// The record holds the previous value at the time of the call
|
|
||||||
onRecordChange(record:Record, context) {}
|
onRecordChange(record:Record, context) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
ChangeDetector,
|
ChangeDetector,
|
||||||
ProtoRecordRange,
|
ProtoRecordRange,
|
||||||
RecordRange,
|
RecordRange,
|
||||||
WatchGroupDispatcher,
|
ChangeDispatcher,
|
||||||
ProtoRecord
|
ProtoRecord
|
||||||
} from 'change_detection/change_detector';
|
} from 'change_detection/change_detector';
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ class TestData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestDispatcher extends WatchGroupDispatcher {
|
class TestDispatcher extends ChangeDispatcher {
|
||||||
log:List;
|
log:List;
|
||||||
loggedValues:List;
|
loggedValues:List;
|
||||||
onChange:Function;
|
onChange:Function;
|
||||||
|
@ -9,7 +9,6 @@ import {
|
|||||||
ChangeDetector,
|
ChangeDetector,
|
||||||
ProtoRecordRange,
|
ProtoRecordRange,
|
||||||
RecordRange,
|
RecordRange,
|
||||||
WatchGroupDispatcher,
|
|
||||||
ProtoRecord
|
ProtoRecord
|
||||||
} from 'change_detection/change_detector';
|
} from 'change_detection/change_detector';
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {DOM, Element, Node, Text, DocumentFragment, TemplateElement} from 'facade/dom';
|
import {DOM, Element, Node, Text, DocumentFragment, TemplateElement} from 'facade/dom';
|
||||||
import {ListWrapper, MapWrapper, StringMapWrapper, List} from 'facade/collection';
|
import {ListWrapper, MapWrapper, StringMapWrapper, List} from 'facade/collection';
|
||||||
import {ProtoRecordRange, RecordRange, WatchGroupDispatcher} from 'change_detection/record_range';
|
import {ProtoRecordRange, RecordRange, ChangeDispatcher} from 'change_detection/record_range';
|
||||||
import {Record} from 'change_detection/record';
|
import {Record} from 'change_detection/record';
|
||||||
import {AST} from 'change_detection/parser/ast';
|
import {AST} from 'change_detection/parser/ast';
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ const NG_BINDING_CLASS = 'ng-binding';
|
|||||||
/**
|
/**
|
||||||
* Const of making objects: http://jsperf.com/instantiate-size-of-object
|
* Const of making objects: http://jsperf.com/instantiate-size-of-object
|
||||||
*/
|
*/
|
||||||
@IMPLEMENTS(WatchGroupDispatcher)
|
@IMPLEMENTS(ChangeDispatcher)
|
||||||
export class View {
|
export class View {
|
||||||
/// This list matches the _nodes list. It is sparse, since only Elements have ElementInjector
|
/// This list matches the _nodes list. It is sparse, since only Elements have ElementInjector
|
||||||
rootElementInjectors:List<ElementInjector>;
|
rootElementInjectors:List<ElementInjector>;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user