Skip to content

Commit f0d0fe0

Browse files
committed
refactor(change_detection): cleaned up change_detection.js
1 parent d630d5b commit f0d0fe0

File tree

2 files changed

+74
-79
lines changed

2 files changed

+74
-79
lines changed

modules/angular2/change_detection.js

Lines changed: 14 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -8,87 +8,22 @@
88
export {
99
ASTWithSource, AST, AstTransformer, AccessMember, LiteralArray, ImplicitReceiver
1010
} from './src/change_detection/parser/ast';
11+
1112
export {Lexer} from './src/change_detection/parser/lexer';
1213
export {Parser} from './src/change_detection/parser/parser';
13-
export {Locals}
14-
from './src/change_detection/parser/locals';
15-
export {ExpressionChangedAfterItHasBeenChecked, ChangeDetectionError}
16-
from './src/change_detection/exceptions';
14+
export {Locals} from './src/change_detection/parser/locals';
15+
16+
export {ExpressionChangedAfterItHasBeenChecked, ChangeDetectionError} from './src/change_detection/exceptions';
1717
export {ProtoChangeDetector, ChangeDispatcher, ChangeDetector, ChangeDetection} from './src/change_detection/interfaces';
1818
export {CHECK_ONCE, CHECK_ALWAYS, DETACHED, CHECKED, ON_PUSH, DEFAULT} from './src/change_detection/constants';
19-
export {DynamicProtoChangeDetector, JitProtoChangeDetector}
20-
from './src/change_detection/proto_change_detector';
21-
export {BindingRecord}
22-
from './src/change_detection/binding_record';
23-
export {DirectiveRecord}
24-
from './src/change_detection/directive_record';
25-
export {DynamicChangeDetector}
26-
from './src/change_detection/dynamic_change_detector';
27-
export {BindingPropagationConfig}
28-
from './src/change_detection/binding_propagation_config';
29-
export * from './src/change_detection/pipes/pipe_registry';
19+
export {DynamicProtoChangeDetector, JitProtoChangeDetector} from './src/change_detection/proto_change_detector';
20+
export {BindingRecord} from './src/change_detection/binding_record';
21+
export {DirectiveRecord} from './src/change_detection/directive_record';
22+
export {DynamicChangeDetector} from './src/change_detection/dynamic_change_detector';
23+
export {BindingPropagationConfig} from './src/change_detection/binding_propagation_config';
24+
export {PipeRegistry} from './src/change_detection/pipes/pipe_registry';
3025
export {uninitialized} from './src/change_detection/change_detection_util';
31-
export * from './src/change_detection/pipes/pipe';
32-
33-
import {DynamicProtoChangeDetector, JitProtoChangeDetector}
34-
from './src/change_detection/proto_change_detector';
35-
import {PipeRegistry} from './src/change_detection/pipes/pipe_registry';
36-
import {IterableChangesFactory} from './src/change_detection/pipes/iterable_changes';
37-
import {KeyValueChangesFactory} from './src/change_detection/pipes/keyvalue_changes';
38-
import {NullPipeFactory} from './src/change_detection/pipes/null_pipe';
39-
import {DEFAULT} from './src/change_detection/constants';
40-
import {ChangeDetection, ProtoChangeDetector} from './src/change_detection/interfaces';
41-
42-
export var defaultPipes = {
43-
"iterableDiff" : [
44-
new IterableChangesFactory(),
45-
new NullPipeFactory()
46-
],
47-
"keyValDiff" : [
48-
new KeyValueChangesFactory(),
49-
new NullPipeFactory()
50-
]
51-
};
52-
53-
54-
export class DynamicChangeDetection extends ChangeDetection {
55-
registry:PipeRegistry;
56-
57-
constructor(registry:PipeRegistry) {
58-
super();
59-
this.registry = registry;
60-
}
61-
62-
createProtoChangeDetector(name:string, changeControlStrategy:string = DEFAULT):ProtoChangeDetector{
63-
return new DynamicProtoChangeDetector(this.registry, changeControlStrategy);
64-
}
65-
}
66-
67-
export class JitChangeDetection extends ChangeDetection {
68-
registry:PipeRegistry;
69-
70-
constructor(registry:PipeRegistry) {
71-
super();
72-
this.registry = registry;
73-
}
74-
75-
createProtoChangeDetector(name:string, changeControlStrategy:string = DEFAULT):ProtoChangeDetector{
76-
return new JitProtoChangeDetector(this.registry, changeControlStrategy);
77-
}
78-
}
79-
80-
var _registry = new PipeRegistry(defaultPipes);
81-
82-
/**
83-
* Implements dynamic change detection. See: [ChangeDetection] for more details.
84-
*
85-
* @exportedAs angular2/change_detection
86-
*/
87-
export var dynamicChangeDetection = new DynamicChangeDetection(_registry);
88-
89-
/**
90-
* Implements just-in-time change detection. See: [ChangeDetection] for more details.
91-
*
92-
* @exportedAs angular2/change_detection
93-
*/
94-
export var jitChangeDetection = new JitChangeDetection(_registry);
26+
export {NO_CHANGE, Pipe} from './src/change_detection/pipes/pipe';
27+
export {
28+
defaultPipes, DynamicChangeDetection, JitChangeDetection, dynamicChangeDetection, jitChangeDetection
29+
} from './src/change_detection/change_detection';
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import {DynamicProtoChangeDetector, JitProtoChangeDetector} from './proto_change_detector';
2+
import {PipeRegistry} from './pipes/pipe_registry';
3+
import {IterableChangesFactory} from './pipes/iterable_changes';
4+
import {KeyValueChangesFactory} from './pipes/keyvalue_changes';
5+
import {NullPipeFactory} from './pipes/null_pipe';
6+
import {DEFAULT} from './constants';
7+
import {ChangeDetection, ProtoChangeDetector} from './interfaces';
8+
9+
export var defaultPipes = {
10+
"iterableDiff" : [
11+
new IterableChangesFactory(),
12+
new NullPipeFactory()
13+
],
14+
"keyValDiff" : [
15+
new KeyValueChangesFactory(),
16+
new NullPipeFactory()
17+
]
18+
};
19+
20+
export class DynamicChangeDetection extends ChangeDetection {
21+
registry:PipeRegistry;
22+
23+
constructor(registry:PipeRegistry) {
24+
super();
25+
this.registry = registry;
26+
}
27+
28+
createProtoChangeDetector(name:string, changeControlStrategy:string = DEFAULT):ProtoChangeDetector{
29+
return new DynamicProtoChangeDetector(this.registry, changeControlStrategy);
30+
}
31+
}
32+
33+
export class JitChangeDetection extends ChangeDetection {
34+
registry:PipeRegistry;
35+
36+
constructor(registry:PipeRegistry) {
37+
super();
38+
this.registry = registry;
39+
}
40+
41+
createProtoChangeDetector(name:string, changeControlStrategy:string = DEFAULT):ProtoChangeDetector{
42+
return new JitProtoChangeDetector(this.registry, changeControlStrategy);
43+
}
44+
}
45+
46+
var _registry = new PipeRegistry(defaultPipes);
47+
48+
/**
49+
* Implements dynamic change detection. See: [ChangeDetection] for more details.
50+
*
51+
* @exportedAs angular2/change_detection
52+
*/
53+
export var dynamicChangeDetection = new DynamicChangeDetection(_registry);
54+
55+
/**
56+
* Implements just-in-time change detection. See: [ChangeDetection] for more details.
57+
*
58+
* @exportedAs angular2/change_detection
59+
*/
60+
export var jitChangeDetection = new JitChangeDetection(_registry);

0 commit comments

Comments
 (0)