refactor(change_detection): cleaned up change_detection.js
This commit is contained in:
parent
d630d5baa5
commit
f0d0fe0801
|
@ -8,87 +8,22 @@
|
||||||
export {
|
export {
|
||||||
ASTWithSource, AST, AstTransformer, AccessMember, LiteralArray, ImplicitReceiver
|
ASTWithSource, AST, AstTransformer, AccessMember, LiteralArray, ImplicitReceiver
|
||||||
} from './src/change_detection/parser/ast';
|
} from './src/change_detection/parser/ast';
|
||||||
|
|
||||||
export {Lexer} from './src/change_detection/parser/lexer';
|
export {Lexer} from './src/change_detection/parser/lexer';
|
||||||
export {Parser} from './src/change_detection/parser/parser';
|
export {Parser} from './src/change_detection/parser/parser';
|
||||||
export {Locals}
|
export {Locals} from './src/change_detection/parser/locals';
|
||||||
from './src/change_detection/parser/locals';
|
|
||||||
export {ExpressionChangedAfterItHasBeenChecked, ChangeDetectionError}
|
export {ExpressionChangedAfterItHasBeenChecked, ChangeDetectionError} from './src/change_detection/exceptions';
|
||||||
from './src/change_detection/exceptions';
|
|
||||||
export {ProtoChangeDetector, ChangeDispatcher, ChangeDetector, ChangeDetection} from './src/change_detection/interfaces';
|
export {ProtoChangeDetector, ChangeDispatcher, ChangeDetector, ChangeDetection} from './src/change_detection/interfaces';
|
||||||
export {CHECK_ONCE, CHECK_ALWAYS, DETACHED, CHECKED, ON_PUSH, DEFAULT} from './src/change_detection/constants';
|
export {CHECK_ONCE, CHECK_ALWAYS, DETACHED, CHECKED, ON_PUSH, DEFAULT} from './src/change_detection/constants';
|
||||||
export {DynamicProtoChangeDetector, JitProtoChangeDetector}
|
export {DynamicProtoChangeDetector, JitProtoChangeDetector} from './src/change_detection/proto_change_detector';
|
||||||
from './src/change_detection/proto_change_detector';
|
export {BindingRecord} from './src/change_detection/binding_record';
|
||||||
export {BindingRecord}
|
export {DirectiveRecord} from './src/change_detection/directive_record';
|
||||||
from './src/change_detection/binding_record';
|
export {DynamicChangeDetector} from './src/change_detection/dynamic_change_detector';
|
||||||
export {DirectiveRecord}
|
export {BindingPropagationConfig} from './src/change_detection/binding_propagation_config';
|
||||||
from './src/change_detection/directive_record';
|
export {PipeRegistry} from './src/change_detection/pipes/pipe_registry';
|
||||||
export {DynamicChangeDetector}
|
|
||||||
from './src/change_detection/dynamic_change_detector';
|
|
||||||
export {BindingPropagationConfig}
|
|
||||||
from './src/change_detection/binding_propagation_config';
|
|
||||||
export * from './src/change_detection/pipes/pipe_registry';
|
|
||||||
export {uninitialized} from './src/change_detection/change_detection_util';
|
export {uninitialized} from './src/change_detection/change_detection_util';
|
||||||
export * from './src/change_detection/pipes/pipe';
|
export {NO_CHANGE, Pipe} from './src/change_detection/pipes/pipe';
|
||||||
|
export {
|
||||||
import {DynamicProtoChangeDetector, JitProtoChangeDetector}
|
defaultPipes, DynamicChangeDetection, JitChangeDetection, dynamicChangeDetection, jitChangeDetection
|
||||||
from './src/change_detection/proto_change_detector';
|
} from './src/change_detection/change_detection';
|
||||||
import {PipeRegistry} from './src/change_detection/pipes/pipe_registry';
|
|
||||||
import {IterableChangesFactory} from './src/change_detection/pipes/iterable_changes';
|
|
||||||
import {KeyValueChangesFactory} from './src/change_detection/pipes/keyvalue_changes';
|
|
||||||
import {NullPipeFactory} from './src/change_detection/pipes/null_pipe';
|
|
||||||
import {DEFAULT} from './src/change_detection/constants';
|
|
||||||
import {ChangeDetection, ProtoChangeDetector} from './src/change_detection/interfaces';
|
|
||||||
|
|
||||||
export var defaultPipes = {
|
|
||||||
"iterableDiff" : [
|
|
||||||
new IterableChangesFactory(),
|
|
||||||
new NullPipeFactory()
|
|
||||||
],
|
|
||||||
"keyValDiff" : [
|
|
||||||
new KeyValueChangesFactory(),
|
|
||||||
new NullPipeFactory()
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export class DynamicChangeDetection extends ChangeDetection {
|
|
||||||
registry:PipeRegistry;
|
|
||||||
|
|
||||||
constructor(registry:PipeRegistry) {
|
|
||||||
super();
|
|
||||||
this.registry = registry;
|
|
||||||
}
|
|
||||||
|
|
||||||
createProtoChangeDetector(name:string, changeControlStrategy:string = DEFAULT):ProtoChangeDetector{
|
|
||||||
return new DynamicProtoChangeDetector(this.registry, changeControlStrategy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class JitChangeDetection extends ChangeDetection {
|
|
||||||
registry:PipeRegistry;
|
|
||||||
|
|
||||||
constructor(registry:PipeRegistry) {
|
|
||||||
super();
|
|
||||||
this.registry = registry;
|
|
||||||
}
|
|
||||||
|
|
||||||
createProtoChangeDetector(name:string, changeControlStrategy:string = DEFAULT):ProtoChangeDetector{
|
|
||||||
return new JitProtoChangeDetector(this.registry, changeControlStrategy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var _registry = new PipeRegistry(defaultPipes);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements dynamic change detection. See: [ChangeDetection] for more details.
|
|
||||||
*
|
|
||||||
* @exportedAs angular2/change_detection
|
|
||||||
*/
|
|
||||||
export var dynamicChangeDetection = new DynamicChangeDetection(_registry);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements just-in-time change detection. See: [ChangeDetection] for more details.
|
|
||||||
*
|
|
||||||
* @exportedAs angular2/change_detection
|
|
||||||
*/
|
|
||||||
export var jitChangeDetection = new JitChangeDetection(_registry);
|
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
import {DynamicProtoChangeDetector, JitProtoChangeDetector} from './proto_change_detector';
|
||||||
|
import {PipeRegistry} from './pipes/pipe_registry';
|
||||||
|
import {IterableChangesFactory} from './pipes/iterable_changes';
|
||||||
|
import {KeyValueChangesFactory} from './pipes/keyvalue_changes';
|
||||||
|
import {NullPipeFactory} from './pipes/null_pipe';
|
||||||
|
import {DEFAULT} from './constants';
|
||||||
|
import {ChangeDetection, ProtoChangeDetector} from './interfaces';
|
||||||
|
|
||||||
|
export var defaultPipes = {
|
||||||
|
"iterableDiff" : [
|
||||||
|
new IterableChangesFactory(),
|
||||||
|
new NullPipeFactory()
|
||||||
|
],
|
||||||
|
"keyValDiff" : [
|
||||||
|
new KeyValueChangesFactory(),
|
||||||
|
new NullPipeFactory()
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
export class DynamicChangeDetection extends ChangeDetection {
|
||||||
|
registry:PipeRegistry;
|
||||||
|
|
||||||
|
constructor(registry:PipeRegistry) {
|
||||||
|
super();
|
||||||
|
this.registry = registry;
|
||||||
|
}
|
||||||
|
|
||||||
|
createProtoChangeDetector(name:string, changeControlStrategy:string = DEFAULT):ProtoChangeDetector{
|
||||||
|
return new DynamicProtoChangeDetector(this.registry, changeControlStrategy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class JitChangeDetection extends ChangeDetection {
|
||||||
|
registry:PipeRegistry;
|
||||||
|
|
||||||
|
constructor(registry:PipeRegistry) {
|
||||||
|
super();
|
||||||
|
this.registry = registry;
|
||||||
|
}
|
||||||
|
|
||||||
|
createProtoChangeDetector(name:string, changeControlStrategy:string = DEFAULT):ProtoChangeDetector{
|
||||||
|
return new JitProtoChangeDetector(this.registry, changeControlStrategy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _registry = new PipeRegistry(defaultPipes);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements dynamic change detection. See: [ChangeDetection] for more details.
|
||||||
|
*
|
||||||
|
* @exportedAs angular2/change_detection
|
||||||
|
*/
|
||||||
|
export var dynamicChangeDetection = new DynamicChangeDetection(_registry);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements just-in-time change detection. See: [ChangeDetection] for more details.
|
||||||
|
*
|
||||||
|
* @exportedAs angular2/change_detection
|
||||||
|
*/
|
||||||
|
export var jitChangeDetection = new JitChangeDetection(_registry);
|
Loading…
Reference in New Issue