refactor(pipes): rename PipeRegistry to Pipes

BREAKING CHANGE:
    This change renames all instances of PipeRegistry to Pipes.
    As part of this change, the former "defaultPipes" export is
    now a Pipes instance, instead of a map. The map that was previously
    called "defaultPipes" no longer exists, but may be accessed via
    defaultPipes.config.
This commit is contained in:
Jeff Cross
2015-07-09 10:34:51 -07:00
parent 8b3efdf229
commit 9a70f84e60
20 changed files with 90 additions and 104 deletions

View File

@ -52,7 +52,7 @@ import {
onAllChangesDone
} from 'angular2/src/core/annotations_impl/annotations';
import {hasLifecycleHook} from './directive_lifecycle_reflector';
import {ChangeDetector, ChangeDetectorRef, PipeRegistry} from 'angular2/change_detection';
import {ChangeDetector, ChangeDetectorRef, Pipes} from 'angular2/change_detection';
import {QueryList} from './query_list';
import {reflector} from 'angular2/src/reflection/reflection';
import {DirectiveMetadata} from 'angular2/src/render/api';
@ -65,7 +65,7 @@ export class StaticKeys {
viewContainerId: number;
changeDetectorRefId: number;
elementRefId: number;
pipeRegistryKey: Key;
pipesKey: Key;
constructor() {
this.viewManagerId = Key.get(avmModule.AppViewManager).id;
@ -74,7 +74,7 @@ export class StaticKeys {
this.changeDetectorRefId = Key.get(ChangeDetectorRef).id;
this.elementRefId = Key.get(ElementRef).id;
// not an id because the public API of injector works only with keys and tokens
this.pipeRegistryKey = Key.get(PipeRegistry);
this.pipesKey = Key.get(Pipes);
}
static instance(): StaticKeys {
@ -550,9 +550,9 @@ export class ElementInjector extends TreeNode<ElementInjector> implements Depend
injector.internalStrategy.hydrate();
}
getPipeRegistry(): PipeRegistry {
var pipeRegistryKey = StaticKeys.instance().pipeRegistryKey;
return this._injector.getOptional(pipeRegistryKey);
getPipes(): Pipes {
var pipesKey = StaticKeys.instance().pipesKey;
return this._injector.getOptional(pipesKey);
}
hasVariableBinding(name: string): boolean {

View File

@ -162,16 +162,15 @@ export class AppViewManagerUtils {
this._setUpHostActions(view, elementInjector, i);
}
}
var pipeRegistry = this._getPipeRegistry(imperativelyCreatedInjector, hostElementInjector);
view.changeDetector.hydrate(view.context, view.locals, view, pipeRegistry);
var pipes = this._getPipes(imperativelyCreatedInjector, hostElementInjector);
view.changeDetector.hydrate(view.context, view.locals, view, pipes);
}
_getPipeRegistry(imperativelyCreatedInjector: Injector,
hostElementInjector: eli.ElementInjector) {
var pipeRegistryKey = eli.StaticKeys.instance().pipeRegistryKey;
_getPipes(imperativelyCreatedInjector: Injector, hostElementInjector: eli.ElementInjector) {
var pipesKey = eli.StaticKeys.instance().pipesKey;
if (isPresent(imperativelyCreatedInjector))
return imperativelyCreatedInjector.getOptional(pipeRegistryKey);
if (isPresent(hostElementInjector)) return hostElementInjector.getPipeRegistry();
return imperativelyCreatedInjector.getOptional(pipesKey);
if (isPresent(hostElementInjector)) return hostElementInjector.getPipes();
return null;
}