From c362f33fe492c0dde45be3ffa6d5fc6e34defd62 Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Thu, 4 Dec 2014 13:16:38 +0100 Subject: [PATCH] style(Change Detection): rename WatchGroupDispatcher to ChangeDispatcher --- .../change_detection/change_detection_benchmark.js | 6 +++--- modules/change_detection/src/record.js | 2 +- modules/change_detection/src/record_range.js | 14 +++++++------- .../change_detection/test/change_detector_spec.js | 4 ++-- modules/change_detection/test/record_range_spec.js | 1 - modules/core/src/compiler/view.js | 4 ++-- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/modules/benchmarks/src/change_detection/change_detection_benchmark.js b/modules/benchmarks/src/change_detection/change_detection_benchmark.js index a9f56b8b1c..6c35b0f058 100644 --- a/modules/benchmarks/src/change_detection/change_detection_benchmark.js +++ b/modules/benchmarks/src/change_detection/change_detection_benchmark.js @@ -8,7 +8,7 @@ import {benchmark, benchmarkStep} from 'benchpress/benchpress'; import { ChangeDetector, ProtoRecordRange, - WatchGroupDispatcher, + ChangeDispatcher, } from 'change_detection/change_detector'; @@ -180,7 +180,7 @@ export function main () { } -class DummyDispatcher extends WatchGroupDispatcher { +class DummyDispatcher extends ChangeDispatcher { onRecordChange(record, context) { } -} \ No newline at end of file +} diff --git a/modules/change_detection/src/record.js b/modules/change_detection/src/record.js index 79bda1b5db..097849c564 100644 --- a/modules/change_detection/src/record.js +++ b/modules/change_detection/src/record.js @@ -103,7 +103,7 @@ export class Record { // Opaque data which will be the target of notification. // 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; constructor(recordRange:RecordRange, protoRecord:ProtoRecord, formatters:Map) { diff --git a/modules/change_detection/src/record_range.js b/modules/change_detection/src/record_range.js index b18d547065..3e8fef2d1a 100644 --- a/modules/change_detection/src/record_range.js +++ b/modules/change_detection/src/record_range.js @@ -45,9 +45,10 @@ export class ProtoRecordRange { * Parses [ast] into [ProtoRecord]s and adds them to [ProtoRecordRange]. * * @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. - * @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, expressionMemento, @@ -65,7 +66,7 @@ export class ProtoRecordRange { 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. instantiate(dispatcher, formatters:Map):RecordRange { var recordRange:RecordRange = new RecordRange(this, dispatcher); @@ -98,11 +99,11 @@ export class ProtoRecordRange { export class RecordRange { protoRecordRange:ProtoRecordRange; - dispatcher:any; //WatchGroupDispatcher + dispatcher:any; //ChangeDispatcher headRecord:Record; tailRecord:Record; 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. constructor(protoRecordRange:ProtoRecordRange, dispatcher) { this.protoRecordRange = protoRecordRange; @@ -296,8 +297,7 @@ function _linkEnabled(a:Record, b:Record) { b.prevEnabled = a; } -export class WatchGroupDispatcher { - // The record holds the previous value at the time of the call +export class ChangeDispatcher { onRecordChange(record:Record, context) {} } diff --git a/modules/change_detection/test/change_detector_spec.js b/modules/change_detection/test/change_detector_spec.js index 8f2e976507..c0a10efa70 100644 --- a/modules/change_detection/test/change_detector_spec.js +++ b/modules/change_detection/test/change_detector_spec.js @@ -11,7 +11,7 @@ import { ChangeDetector, ProtoRecordRange, RecordRange, - WatchGroupDispatcher, + ChangeDispatcher, ProtoRecord } from 'change_detection/change_detector'; @@ -480,7 +480,7 @@ class TestData { } } -class TestDispatcher extends WatchGroupDispatcher { +class TestDispatcher extends ChangeDispatcher { log:List; loggedValues:List; onChange:Function; diff --git a/modules/change_detection/test/record_range_spec.js b/modules/change_detection/test/record_range_spec.js index 51fd2913e7..9be3d28146 100644 --- a/modules/change_detection/test/record_range_spec.js +++ b/modules/change_detection/test/record_range_spec.js @@ -9,7 +9,6 @@ import { ChangeDetector, ProtoRecordRange, RecordRange, - WatchGroupDispatcher, ProtoRecord } from 'change_detection/change_detector'; diff --git a/modules/core/src/compiler/view.js b/modules/core/src/compiler/view.js index 0ecb53cf75..29df335aff 100644 --- a/modules/core/src/compiler/view.js +++ b/modules/core/src/compiler/view.js @@ -1,6 +1,6 @@ import {DOM, Element, Node, Text, DocumentFragment, TemplateElement} from 'facade/dom'; 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 {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 */ -@IMPLEMENTS(WatchGroupDispatcher) +@IMPLEMENTS(ChangeDispatcher) export class View { /// This list matches the _nodes list. It is sparse, since only Elements have ElementInjector rootElementInjectors:List;