refactor(router): remove unused Pipeline

This commit is contained in:
Brian Ford
2015-08-24 14:39:54 -07:00
parent cac25fe003
commit d2458866c1
9 changed files with 18 additions and 70 deletions

View File

@ -1,30 +0,0 @@
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
import {ListWrapper} from 'angular2/src/core/facade/collection';
import {Instruction} from './instruction';
import {Injectable} from 'angular2/src/core/di';
/**
* Responsible for performing each step of navigation.
* "Steps" are conceptually similar to "middleware"
*/
@Injectable()
export class Pipeline {
steps: Function[];
constructor() { this.steps = [instruction => instruction.router.activateOutlets(instruction)]; }
process(instruction: Instruction): Promise<any> {
var steps = this.steps, currentStep = 0;
function processOne(result: any = true): Promise<any> {
if (currentStep >= steps.length) {
return PromiseWrapper.resolve(result);
}
var step = steps[currentStep];
currentStep += 1;
return PromiseWrapper.resolve(step(instruction)).then(processOne);
}
return processOne();
}
}

View File

@ -15,7 +15,6 @@ import {
} from 'angular2/src/core/facade/lang';
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
import {RouteRegistry} from './route_registry';
import {Pipeline} from './pipeline';
import {ComponentInstruction, Instruction, stringifyInstruction} from './instruction';
import {RouterOutlet} from './router_outlet';
import {Location} from './location';
@ -57,8 +56,7 @@ export class Router {
private _subject: EventEmitter = new EventEmitter();
constructor(public registry: RouteRegistry, public _pipeline: Pipeline, public parent: Router,
public hostComponent: any) {}
constructor(public registry: RouteRegistry, public parent: Router, public hostComponent: any) {}
/**
@ -459,9 +457,8 @@ export class Router {
export class RootRouter extends Router {
_location: Location;
constructor(registry: RouteRegistry, pipeline: Pipeline, location: Location,
hostComponent: Type) {
super(registry, pipeline, null, hostComponent);
constructor(registry: RouteRegistry, location: Location, hostComponent: Type) {
super(registry, null, hostComponent);
this._location = location;
this._location.subscribe((change) =>
this.navigateByUrl(change['url'], isPresent(change['pop'])));
@ -485,7 +482,7 @@ export class RootRouter extends Router {
class ChildRouter extends Router {
constructor(parent: Router, hostComponent) {
super(parent.registry, parent._pipeline, parent, hostComponent);
super(parent.registry, parent, hostComponent);
this.parent = parent;
}