Skip to content

Commit b43f8bc

Browse files
committed
feat(core): upgrade rxjs to 6.0.0-alpha.4 (angular#22573)
PR Close angular#22573
1 parent c445314 commit b43f8bc

File tree

270 files changed

+10104
-1860
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

270 files changed

+10104
-1860
lines changed

aio/content/examples/component-interaction/src/app/astronaut.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { Component, Input, OnDestroy } from '@angular/core';
33

44
import { MissionService } from './mission.service';
5-
import { Subscription } from 'rxjs/Subscription';
5+
import { Subscription } from 'rxjs';
66

77
@Component({
88
selector: 'app-astronaut',

aio/content/examples/component-interaction/src/app/mission.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #docregion
22
import { Injectable } from '@angular/core';
3-
import { Subject } from 'rxjs/Subject';
3+
import { Subject } from 'rxjs';
44

55
@Injectable()
66
export class MissionService {

aio/content/examples/hierarchical-dependency-injection/src/app/heroes-list.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #docregion
22
import { Component } from '@angular/core';
3-
import { Observable } from 'rxjs/Observable';
3+
import { Observable } from 'rxjs';
44

55
import { Hero, HeroTaxReturn } from './hero';
66
import { HeroesService } from './heroes.service';

aio/content/examples/hierarchical-dependency-injection/src/app/heroes.service.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Injectable } from '@angular/core';
22

3-
import { Observable } from 'rxjs/Observable';
4-
import { Observer } from 'rxjs/Observer';
3+
import { Observable, Observer } from 'rxjs';
54

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

aio/content/examples/hierarchical-dependency-injection/src/app/villains-list.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #docregion
22
import { Component } from '@angular/core';
3-
import { Observable } from 'rxjs/Observable';
3+
import { Observable } from 'rxjs';
44

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

aio/content/examples/hierarchical-dependency-injection/src/app/villains.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Injectable } from '@angular/core';
22

3-
import { of } from 'rxjs/observable/of';
3+
import { of } from 'rxjs';
44

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

aio/content/examples/http/src/app/config/config.component.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class ConfigComponent {
3030
this.configService.getConfig()
3131
// #enddocregion v1, v2
3232
.subscribe(
33-
data => this.config = { ...data }, // success path
33+
(data: Config) => this.config = { ...data }, // success path
3434
error => this.error = error // error path
3535
);
3636
}
@@ -39,7 +39,7 @@ export class ConfigComponent {
3939
showConfig_v1() {
4040
this.configService.getConfig_1()
4141
// #docregion v1, v1_callback
42-
.subscribe(data => this.config = {
42+
.subscribe((data: Config) => this.config = {
4343
heroesUrl: data['heroesUrl'],
4444
textfile: data['textfile']
4545
});
@@ -51,7 +51,7 @@ export class ConfigComponent {
5151
this.configService.getConfig()
5252
// #docregion v2, v2_callback
5353
// clone the data object, using its known Config shape
54-
.subscribe(data => this.config = { ...data });
54+
.subscribe((data: Config) => this.config = { ...data });
5555
// #enddocregion v2_callback
5656
}
5757
// #enddocregion v2

aio/content/examples/http/src/app/config/config.service.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import { HttpClient } from '@angular/common/http';
66
import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
77

88
// #docregion rxjs-imports
9-
import { Observable } from 'rxjs/Observable';
10-
import { ErrorObservable } from 'rxjs/observable/ErrorObservable';
9+
import { Observable, throwError } from 'rxjs';
1110
import { catchError, retry } from 'rxjs/operators';
1211
// #enddocregion rxjs-imports
1312

@@ -82,8 +81,8 @@ export class ConfigService {
8281
`Backend returned code ${error.status}, ` +
8382
`body was: ${error.error}`);
8483
}
85-
// return an ErrorObservable with a user-facing error message
86-
return new ErrorObservable(
84+
// return an observable with a user-facing error message
85+
return throwError(
8786
'Something bad happened; please try again later.');
8887
};
8988
// #enddocregion handleError

aio/content/examples/http/src/app/heroes/heroes.service.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import { HttpHeaders } from '@angular/common/http';
66

77
// #enddocregion http-options
88

9-
import { Observable } from 'rxjs/Observable';
10-
import { of } from 'rxjs/observable/of';
9+
import { Observable } from 'rxjs';
1110
import { catchError } from 'rxjs/operators';
1211

1312
import { Hero } from './hero';

aio/content/examples/http/src/app/http-error-handler.service.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Injectable } from '@angular/core';
22
import { HttpErrorResponse } from '@angular/common/http';
33

4-
import { Observable } from 'rxjs/Observable';
5-
import { of } from 'rxjs/observable/of';
4+
import { Observable, of } from 'rxjs';
65

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

aio/content/examples/http/src/app/http-interceptors/auth-interceptor.ts

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import {
44
HttpEvent, HttpInterceptor, HttpHandler, HttpRequest
55
} from '@angular/common/http';
66

7-
import { Observable } from 'rxjs/Observable';
8-
97
// #docregion
108
import { AuthService } from '../auth.service';
119

aio/content/examples/http/src/app/http-interceptors/caching-interceptor.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import {
55
HttpInterceptor, HttpHandler
66
} from '@angular/common/http';
77

8-
import { Observable } from 'rxjs/Observable';
9-
import { of } from 'rxjs/observable/of';
8+
import { Observable, of } from 'rxjs';
109
import { startWith, tap } from 'rxjs/operators';
1110

1211
import { RequestCache } from '../request-cache.service';

aio/content/examples/http/src/app/http-interceptors/ensure-https-interceptor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
HttpEvent, HttpInterceptor, HttpHandler, HttpRequest
44
} from '@angular/common/http';
55

6-
import { Observable } from 'rxjs/Observable';
6+
import { Observable } from 'rxjs';
77

88
@Injectable()
99
export class EnsureHttpsInterceptor implements HttpInterceptor {

aio/content/examples/http/src/app/http-interceptors/logging-interceptor.ts

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
HttpRequest, HttpResponse
55
} from '@angular/common/http';
66

7-
import { Observable } from 'rxjs/Observable';
87
// #docregion excerpt
98
import { finalize, tap } from 'rxjs/operators';
109
import { MessageService } from '../message.service';

aio/content/examples/http/src/app/http-interceptors/noop-interceptor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
HttpEvent, HttpInterceptor, HttpHandler, HttpRequest
44
} from '@angular/common/http';
55

6-
import { Observable } from 'rxjs/Observable';
6+
import { Observable } from 'rxjs';
77

88
/** Pass untouched request through to the next request handler. */
99
@Injectable()

aio/content/examples/http/src/app/http-interceptors/trim-name-interceptor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
HttpEvent, HttpInterceptor, HttpHandler, HttpRequest
44
} from '@angular/common/http';
55

6-
import { Observable } from 'rxjs/Observable';
6+
import { Observable } from 'rxjs';
77

88
@Injectable()
99
export class TrimNameInterceptor implements HttpInterceptor {

aio/content/examples/http/src/app/http-interceptors/upload-interceptor.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import {
55
HttpEventType, HttpProgressEvent
66
} from '@angular/common/http';
77

8-
import { Observable } from 'rxjs/Observable';
9-
import { of } from 'rxjs/observable/of';
8+
import { Observable } from 'rxjs';
109

1110
/** Simulate server replying to file upload request */
1211
@Injectable()

aio/content/examples/http/src/app/package-search/package-search.component.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Component, OnInit } from '@angular/core';
22

3-
import { Observable } from 'rxjs/Observable';
4-
import { Subject } from 'rxjs/Subject';
3+
import { Observable, Subject } from 'rxjs';
54
import { debounceTime, distinctUntilChanged, switchMap } from 'rxjs/operators';
65

76
import { NpmPackageInfo, PackageSearchService } from './package-search.service';

aio/content/examples/http/src/app/package-search/package-search.service.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Injectable } from '@angular/core';
22
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
33

4-
import { Observable } from 'rxjs/Observable';
5-
import { of } from 'rxjs/observable/of';
4+
import { Observable, of } from 'rxjs';
65
import { catchError, map } from 'rxjs/operators';
76

87
import { HttpErrorHandler, HandleError } from '../http-error-handler.service';

aio/content/examples/http/src/app/uploader/uploader.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
HttpRequest, HttpResponse, HttpErrorResponse
55
} from '@angular/common/http';
66

7-
import { of } from 'rxjs/observable/of';
7+
import { of } from 'rxjs';
88
import { catchError, last, map, tap } from 'rxjs/operators';
99

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

aio/content/examples/ngmodule-faq/src/app/contact/contact.service.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
// #docregion
33
import { Injectable, OnDestroy } from '@angular/core';
44

5-
import { Observable } from 'rxjs/Observable';
6-
import { of } from 'rxjs/observable/of';
5+
import { Observable, of } from 'rxjs';
76
import { delay } from 'rxjs/operators';
87

98
export class Contact {

aio/content/examples/ngmodule-faq/src/app/crisis/crisis-list.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component } from '@angular/core';
2-
import { Observable } from 'rxjs/Observable';
2+
import { Observable } from 'rxjs';
33

44
import { Crisis,
55
CrisisService } from './crisis.service';

aio/content/examples/ngmodule-faq/src/app/crisis/crisis.service.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Injectable, OnDestroy } from '@angular/core';
22

3-
import { Observable } from 'rxjs/Observable';
4-
import { of } from 'rxjs/observable/of';
3+
import { Observable, of } from 'rxjs';
54
import { delay } from 'rxjs/operators';
65

76
export class Crisis {

aio/content/examples/ngmodule-faq/src/app/hero/hero-list.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component } from '@angular/core';
2-
import { Observable } from 'rxjs/Observable';
2+
import { Observable } from 'rxjs';
33

44
import { Hero,
55
HeroService } from './hero.service';

aio/content/examples/ngmodule-faq/src/app/hero/hero.service.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Injectable, OnDestroy } from '@angular/core';
22

3-
import { Observable } from 'rxjs/Observable';
4-
import { of } from 'rxjs/observable/of';
3+
import { Observable, of } from 'rxjs';
54
import { delay } from 'rxjs/operators';
65

76
export class Hero {

aio/content/examples/ngmodules/src/app/contact/contact.service.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Injectable, OnDestroy } from '@angular/core';
22

3-
import { Observable } from 'rxjs/Observable';
4-
import { of } from 'rxjs/observable/of';
5-
import { delay } from 'rxjs/operator/delay';
3+
import { Observable, of } from 'rxjs';
4+
import { delay } from 'rxjs/operators';
65

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

2625
getContacts(): Observable<Contact[]> {
27-
return delay.call(of(CONTACTS), FETCH_LATENCY);
26+
return of(CONTACTS).pipe(delay(FETCH_LATENCY));
2827
}
2928

3029
getContact(id: number | string): Observable<Contact> {
3130
const contact$ = of(CONTACTS.find(contact => contact.id === +id));
32-
return delay.call(contact$, FETCH_LATENCY);
31+
return contact$.pipe(delay(FETCH_LATENCY));
3332
}
3433
}
3534

aio/content/examples/ngmodules/src/app/customers/customers-list.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { Observable } from 'rxjs/Observable';
2+
import { Observable } from 'rxjs';
33

44
import { Customer,
55
CustomersService } from './customers.service';

aio/content/examples/ngmodules/src/app/customers/customers.service.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Injectable, OnDestroy } from '@angular/core';
22

3-
import { Observable } from 'rxjs/Observable';
4-
import { of } from 'rxjs/observable/of';
5-
import { delay } from 'rxjs/operator/delay';
3+
import { Observable, of } from 'rxjs';
4+
import { delay } from 'rxjs/operators';
65

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

2928
getCustomers(): Observable<Customer[]> {
30-
return delay.call(of(CUSTOMERS), FETCH_LATENCY);
29+
return of(CUSTOMERS).pipe(delay(FETCH_LATENCY));
3130
}
3231

3332
getCustomer(id: number | string): Observable<Customer> {
3433
const customer$ = of(CUSTOMERS.find(customer => customer.id === +id));
35-
return delay.call(customer$, FETCH_LATENCY);
34+
return customer$.pipe(delay(FETCH_LATENCY));
3635
}
3736
}

aio/content/examples/ngmodules/src/app/items/items-list.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { Observable }from 'rxjs/Observable';
2+
import { Observable }from 'rxjs';
33

44
import { Item,
55
ItemService } from './items.service';
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { NgModule } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33

4+
import { ItemsComponent } from './items.component';
45
import { ItemsListComponent } from './items-list.component';
56
import { ItemsDetailComponent } from './items-detail.component';
67
import { ItemService } from './items.service';
78
import { ItemsRoutingModule } from './items-routing.module';
89

910
@NgModule({
1011
imports: [ CommonModule, ItemsRoutingModule ],
11-
declarations: [ ItemsDetailComponent, ItemsListComponent ],
12+
declarations: [ ItemsComponent, ItemsDetailComponent, ItemsListComponent ],
1213
providers: [ ItemService ]
1314
})
1415
export class ItemsModule {}

aio/content/examples/ngmodules/src/app/items/items.service.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Injectable, OnDestroy } from '@angular/core';
22

3-
import { Observable } from 'rxjs/Observable';
4-
import { of } from 'rxjs/observable/of';
5-
import { delay } from 'rxjs/operator/delay';
3+
import { Observable, of } from 'rxjs';
4+
import { delay } from 'rxjs/operators';
65

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

2726
getItems(): Observable<Item[]> {
28-
return delay.call(of(ITEMS), FETCH_LATENCY);
27+
return of(ITEMS).pipe(delay(FETCH_LATENCY));
2928
}
3029

3130
getItem(id: number | string): Observable<Item> {
3231
const item$ = of(ITEMS.find(item => item.id === +id));
33-
return delay.call(item$, FETCH_LATENCY);
32+
return item$.pipe(delay(FETCH_LATENCY));
3433
}
3534
}
3635

aio/content/examples/observables-in-angular/src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
import { Component, Output, OnInit, EventEmitter, NgModule } from '@angular/core';
3-
import { Observable } from 'rxjs/Observable';
3+
import { Observable } from 'rxjs';
44

55
// #docregion eventemitter
66

aio/content/examples/observables/src/creating.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
import { Observable } from 'rxjs/Observable';
2+
import { Observable } from 'rxjs';
33

44
// #docregion subscriber
55

aio/content/examples/observables/src/geolocation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Observable } from 'rxjs/Observable';
1+
import { Observable } from 'rxjs';
22

33
// #docregion
44

aio/content/examples/observables/src/multicasting.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
import { Observable } from 'rxjs/Observable';
2+
import { Observable } from 'rxjs';
33

44
// #docregion delay_sequence
55

aio/content/examples/observables/src/subscribing.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

2-
import { Observable } from 'rxjs/Observable';
3-
import 'rxjs/add/observable/of';
2+
import { Observable, of } from 'rxjs';
43

54
// #docregion observer
65

0 commit comments

Comments
 (0)