refactor(router): not use reserved words as variable (#9941)

This commit is contained in:
LongYinan 2016-07-12 01:53:29 +08:00 committed by Victor Berchet
parent 57473e72ec
commit 61e18434d3
1 changed files with 8 additions and 8 deletions

View File

@ -13,13 +13,13 @@ import 'rxjs/add/operator/reduce';
import 'rxjs/add/operator/every';
import 'rxjs/add/observable/from';
import 'rxjs/add/observable/forkJoin';
import 'rxjs/add/observable/of';
import {Location} from '@angular/common';
import {AppModuleFactoryLoader, ComponentFactoryResolver, ComponentResolver, Injector, ReflectiveInjector, Type} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Subject} from 'rxjs/Subject';
import {Subscription} from 'rxjs/Subscription';
import {of } from 'rxjs/observable/of';
import {applyRedirects} from './apply_redirects';
import {ResolveData, Routes, validateConfig} from './config';
@ -347,7 +347,7 @@ export class Router {
if (shouldActivate) {
return preActivation.resolveData().map(() => shouldActivate);
} else {
return of (shouldActivate);
return Observable.of(shouldActivate);
}
})
@ -413,7 +413,7 @@ class PreActivation {
}
checkGuards(): Observable<boolean> {
if (this.checks.length === 0) return of (true);
if (this.checks.length === 0) return Observable.of(true);
return Observable.from(this.checks)
.map(s => {
if (s instanceof CanActivate) {
@ -431,13 +431,13 @@ class PreActivation {
}
resolveData(): Observable<any> {
if (this.checks.length === 0) return of (null);
if (this.checks.length === 0) return Observable.of(null);
return Observable.from(this.checks)
.mergeMap(s => {
if (s instanceof CanActivate) {
return this.runResolve(s.route);
} else {
return of (null);
return Observable.of(null);
}
})
.reduce((_, __) => _);
@ -518,7 +518,7 @@ class PreActivation {
private runCanActivate(future: ActivatedRouteSnapshot): Observable<boolean> {
const canActivate = future._routeConfig ? future._routeConfig.canActivate : null;
if (!canActivate || canActivate.length === 0) return of (true);
if (!canActivate || canActivate.length === 0) return Observable.of(true);
return Observable.from(canActivate)
.map(c => {
const guard = this.injector.get(c);
@ -534,7 +534,7 @@ class PreActivation {
private runCanDeactivate(component: Object, curr: ActivatedRouteSnapshot): Observable<boolean> {
const canDeactivate = curr && curr._routeConfig ? curr._routeConfig.canDeactivate : null;
if (!canDeactivate || canDeactivate.length === 0) return of (true);
if (!canDeactivate || canDeactivate.length === 0) return Observable.of(true);
return Observable.from(canDeactivate)
.map(c => {
const guard = this.injector.get(c);
@ -571,7 +571,7 @@ function wrapIntoObservable<T>(value: T | Observable<T>): Observable<T> {
if (value instanceof Observable) {
return value;
} else {
return of (value);
return Observable.of(value);
}
}