From adec6ac6cef2513f8be279cfb60553134eb996db Mon Sep 17 00:00:00 2001 From: Ward Bell Date: Tue, 31 Jan 2017 17:32:36 -0800 Subject: [PATCH] chore(hierarchical-dependency-injection): Subscriber -> Observer (#3097) --- .../ts/app/heroes.service.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/public/docs/_examples/hierarchical-dependency-injection/ts/app/heroes.service.ts b/public/docs/_examples/hierarchical-dependency-injection/ts/app/heroes.service.ts index 72433b29f7..85b33c89a0 100644 --- a/public/docs/_examples/hierarchical-dependency-injection/ts/app/heroes.service.ts +++ b/public/docs/_examples/hierarchical-dependency-injection/ts/app/heroes.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; -import { Subscriber } from 'rxjs/Subscriber'; +import { Observer } from 'rxjs/Observer'; import { Hero, HeroTaxReturn } from './hero'; @@ -18,30 +18,30 @@ export class HeroesService { ]; getHeroes(): Observable { - return new Observable((subscriber: Subscriber) => { - subscriber.next(this.heroes); - subscriber.complete(); + return new Observable((observer: Observer) => { + observer.next(this.heroes); + observer.complete(); }); } getTaxReturn(hero: Hero): Observable { - return new Observable((subscriber: Subscriber) => { + return new Observable((observer: Observer) => { const htr = this.heroTaxReturns.find(t => t.hero.id === hero.id); - subscriber.next(htr || new HeroTaxReturn(0, hero)); - subscriber.complete(); + observer.next(htr || new HeroTaxReturn(0, hero)); + observer.complete(); }); } saveTaxReturn(heroTaxReturn: HeroTaxReturn): Observable { - return new Observable((subscriber: Subscriber) => { + return new Observable((observer: Observer) => { const htr = this.heroTaxReturns.find(t => t.id === heroTaxReturn.id); if (htr) { heroTaxReturn = Object.assign(htr, heroTaxReturn); // demo: mutate } else { this.heroTaxReturns.push(heroTaxReturn); } - subscriber.next(heroTaxReturn); - subscriber.complete(); + observer.next(heroTaxReturn); + observer.complete(); }); } }