Skip to content

Commit

Permalink
feat(core): upgrade rxjs to 6.0.0-alpha.4 (angular#22573)
Browse files Browse the repository at this point in the history
PR Close angular#22573
  • Loading branch information
IgorMinar committed Mar 20, 2018
1 parent c445314 commit b43f8bc
Show file tree
Hide file tree
Showing 270 changed files with 10,104 additions and 1,860 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Component, Input, OnDestroy } from '@angular/core';

import { MissionService } from './mission.service';
import { Subscription } from 'rxjs/Subscription';
import { Subscription } from 'rxjs';

@Component({
selector: 'app-astronaut',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// #docregion
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
import { Subject } from 'rxjs';

@Injectable()
export class MissionService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// #docregion
import { Component } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';

import { Hero, HeroTaxReturn } from './hero';
import { HeroesService } from './heroes.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Injectable } from '@angular/core';

import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
import { Observable, Observer } from 'rxjs';

import { Hero, HeroTaxReturn } from './hero';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// #docregion
import { Component } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';

import { Villain, VillainsService } from './villains.service';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';

import { of } from 'rxjs/observable/of';
import { of } from 'rxjs';

export interface Villain { id: number; name: string; }

Expand Down
6 changes: 3 additions & 3 deletions aio/content/examples/http/src/app/config/config.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class ConfigComponent {
this.configService.getConfig()
// #enddocregion v1, v2
.subscribe(
data => this.config = { ...data }, // success path
(data: Config) => this.config = { ...data }, // success path
error => this.error = error // error path
);
}
Expand All @@ -39,7 +39,7 @@ export class ConfigComponent {
showConfig_v1() {
this.configService.getConfig_1()
// #docregion v1, v1_callback
.subscribe(data => this.config = {
.subscribe((data: Config) => this.config = {
heroesUrl: data['heroesUrl'],
textfile: data['textfile']
});
Expand All @@ -51,7 +51,7 @@ export class ConfigComponent {
this.configService.getConfig()
// #docregion v2, v2_callback
// clone the data object, using its known Config shape
.subscribe(data => this.config = { ...data });
.subscribe((data: Config) => this.config = { ...data });
// #enddocregion v2_callback
}
// #enddocregion v2
Expand Down
7 changes: 3 additions & 4 deletions aio/content/examples/http/src/app/config/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { HttpClient } from '@angular/common/http';
import { HttpErrorResponse, HttpResponse } from '@angular/common/http';

// #docregion rxjs-imports
import { Observable } from 'rxjs/Observable';
import { ErrorObservable } from 'rxjs/observable/ErrorObservable';
import { Observable, throwError } from 'rxjs';
import { catchError, retry } from 'rxjs/operators';
// #enddocregion rxjs-imports

Expand Down Expand Up @@ -82,8 +81,8 @@ export class ConfigService {
`Backend returned code ${error.status}, ` +
`body was: ${error.error}`);
}
// return an ErrorObservable with a user-facing error message
return new ErrorObservable(
// return an observable with a user-facing error message
return throwError(
'Something bad happened; please try again later.');
};
// #enddocregion handleError
Expand Down
3 changes: 1 addition & 2 deletions aio/content/examples/http/src/app/heroes/heroes.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { HttpHeaders } from '@angular/common/http';

// #enddocregion http-options

import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { Observable } from 'rxjs';
import { catchError } from 'rxjs/operators';

import { Hero } from './hero';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Injectable } from '@angular/core';
import { HttpErrorResponse } from '@angular/common/http';

import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { Observable, of } from 'rxjs';

import { MessageService } from './message.service';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import {
HttpEvent, HttpInterceptor, HttpHandler, HttpRequest
} from '@angular/common/http';

import { Observable } from 'rxjs/Observable';

// #docregion
import { AuthService } from '../auth.service';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import {
HttpInterceptor, HttpHandler
} from '@angular/common/http';

import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { Observable, of } from 'rxjs';
import { startWith, tap } from 'rxjs/operators';

import { RequestCache } from '../request-cache.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
HttpEvent, HttpInterceptor, HttpHandler, HttpRequest
} from '@angular/common/http';

import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';

@Injectable()
export class EnsureHttpsInterceptor implements HttpInterceptor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
HttpRequest, HttpResponse
} from '@angular/common/http';

import { Observable } from 'rxjs/Observable';
// #docregion excerpt
import { finalize, tap } from 'rxjs/operators';
import { MessageService } from '../message.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
HttpEvent, HttpInterceptor, HttpHandler, HttpRequest
} from '@angular/common/http';

import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';

/** Pass untouched request through to the next request handler. */
@Injectable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
HttpEvent, HttpInterceptor, HttpHandler, HttpRequest
} from '@angular/common/http';

import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';

@Injectable()
export class TrimNameInterceptor implements HttpInterceptor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import {
HttpEventType, HttpProgressEvent
} from '@angular/common/http';

import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { Observable } from 'rxjs';

/** Simulate server replying to file upload request */
@Injectable()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Component, OnInit } from '@angular/core';

import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
import { Observable, Subject } from 'rxjs';
import { debounceTime, distinctUntilChanged, switchMap } from 'rxjs/operators';

import { NpmPackageInfo, PackageSearchService } from './package-search.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';

import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { Observable, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';

import { HttpErrorHandler, HandleError } from '../http-error-handler.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
HttpRequest, HttpResponse, HttpErrorResponse
} from '@angular/common/http';

import { of } from 'rxjs/observable/of';
import { of } from 'rxjs';
import { catchError, last, map, tap } from 'rxjs/operators';

import { MessageService } from '../message.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// #docregion
import { Injectable, OnDestroy } from '@angular/core';

import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { Observable, of } from 'rxjs';
import { delay } from 'rxjs/operators';

export class Contact {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';

import { Crisis,
CrisisService } from './crisis.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Injectable, OnDestroy } from '@angular/core';

import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { Observable, of } from 'rxjs';
import { delay } from 'rxjs/operators';

export class Crisis {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';

import { Hero,
HeroService } from './hero.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Injectable, OnDestroy } from '@angular/core';

import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { Observable, of } from 'rxjs';
import { delay } from 'rxjs/operators';

export class Hero {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Injectable, OnDestroy } from '@angular/core';

import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { delay } from 'rxjs/operator/delay';
import { Observable, of } from 'rxjs';
import { delay } from 'rxjs/operators';

export class Contact {
constructor(public id: number, public name: string) { }
Expand All @@ -24,12 +23,12 @@ export class ContactService implements OnDestroy {
ngOnDestroy() { console.log('ContactService instance destroyed.'); }

getContacts(): Observable<Contact[]> {
return delay.call(of(CONTACTS), FETCH_LATENCY);
return of(CONTACTS).pipe(delay(FETCH_LATENCY));
}

getContact(id: number | string): Observable<Contact> {
const contact$ = of(CONTACTS.find(contact => contact.id === +id));
return delay.call(contact$, FETCH_LATENCY);
return contact$.pipe(delay(FETCH_LATENCY));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';

import { Customer,
CustomersService } from './customers.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Injectable, OnDestroy } from '@angular/core';

import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { delay } from 'rxjs/operator/delay';
import { Observable, of } from 'rxjs';
import { delay } from 'rxjs/operators';

export class Customer {
constructor(public id: number, public name: string) { }
Expand All @@ -27,11 +26,11 @@ export class CustomersService implements OnDestroy {
ngOnDestroy() { console.log('CustomersService instance destroyed.'); }

getCustomers(): Observable<Customer[]> {
return delay.call(of(CUSTOMERS), FETCH_LATENCY);
return of(CUSTOMERS).pipe(delay(FETCH_LATENCY));
}

getCustomer(id: number | string): Observable<Customer> {
const customer$ = of(CUSTOMERS.find(customer => customer.id === +id));
return delay.call(customer$, FETCH_LATENCY);
return customer$.pipe(delay(FETCH_LATENCY));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Observable }from 'rxjs/Observable';
import { Observable }from 'rxjs';

import { Item,
ItemService } from './items.service';
Expand Down
3 changes: 2 additions & 1 deletion aio/content/examples/ngmodules/src/app/items/items.module.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { ItemsComponent } from './items.component';
import { ItemsListComponent } from './items-list.component';
import { ItemsDetailComponent } from './items-detail.component';
import { ItemService } from './items.service';
import { ItemsRoutingModule } from './items-routing.module';

@NgModule({
imports: [ CommonModule, ItemsRoutingModule ],
declarations: [ ItemsDetailComponent, ItemsListComponent ],
declarations: [ ItemsComponent, ItemsDetailComponent, ItemsListComponent ],
providers: [ ItemService ]
})
export class ItemsModule {}
9 changes: 4 additions & 5 deletions aio/content/examples/ngmodules/src/app/items/items.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Injectable, OnDestroy } from '@angular/core';

import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { delay } from 'rxjs/operator/delay';
import { Observable, of } from 'rxjs';
import { delay } from 'rxjs/operators';

export class Item {
constructor(public id: number, public name: string) { }
Expand All @@ -25,12 +24,12 @@ export class ItemService implements OnDestroy {
ngOnDestroy() { console.log('ItemService instance destroyed.'); }

getItems(): Observable<Item[]> {
return delay.call(of(ITEMS), FETCH_LATENCY);
return of(ITEMS).pipe(delay(FETCH_LATENCY));
}

getItem(id: number | string): Observable<Item> {
const item$ = of(ITEMS.find(item => item.id === +id));
return delay.call(item$, FETCH_LATENCY);
return item$.pipe(delay(FETCH_LATENCY));
}
}

Expand Down
2 changes: 1 addition & 1 deletion aio/content/examples/observables-in-angular/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import { Component, Output, OnInit, EventEmitter, NgModule } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';

// #docregion eventemitter

Expand Down
2 changes: 1 addition & 1 deletion aio/content/examples/observables/src/creating.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';

// #docregion subscriber

Expand Down
2 changes: 1 addition & 1 deletion aio/content/examples/observables/src/geolocation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';

// #docregion

Expand Down
2 changes: 1 addition & 1 deletion aio/content/examples/observables/src/multicasting.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';

// #docregion delay_sequence

Expand Down
3 changes: 1 addition & 2 deletions aio/content/examples/observables/src/subscribing.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import { Observable, of } from 'rxjs';

// #docregion observer

Expand Down
Loading

0 comments on commit b43f8bc

Please sign in to comment.