parent
562c629d22
commit
b7a9a4524f
|
@ -14,12 +14,14 @@ export class HeroService {
|
||||||
}
|
}
|
||||||
// #enddocregion get-heroes, just-get-heroes
|
// #enddocregion get-heroes, just-get-heroes
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
||||||
// See the "Take it slow" appendix
|
// See the "Take it slow" appendix
|
||||||
// #docregion get-heroes-slowly
|
// #docregion get-heroes-slowly
|
||||||
getHeroesSlowly(): Promise<Hero[]> {
|
getHeroesSlowly(): Promise<Hero[]> {
|
||||||
return new Promise<Hero[]>(resolve =>
|
return new Promise(resolve => {
|
||||||
setTimeout(resolve, 2000)) // delay 2 seconds
|
// Simulate server latency with 2 second delay
|
||||||
.then(() => this.getHeroes());
|
setTimeout(() => resolve(this.getHeroes()), 2000);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
// #enddocregion get-heroes-slowly
|
// #enddocregion get-heroes-slowly
|
||||||
// #docregion
|
// #docregion
|
||||||
|
|
|
@ -11,9 +11,10 @@ export class HeroService {
|
||||||
}
|
}
|
||||||
|
|
||||||
getHeroesSlowly(): Promise<Hero[]> {
|
getHeroesSlowly(): Promise<Hero[]> {
|
||||||
return new Promise<Hero[]>(resolve =>
|
return new Promise(resolve => {
|
||||||
setTimeout(resolve, 2000)) // delay 2 seconds
|
// Simulate server latency with 2 second delay
|
||||||
.then(() => this.getHeroes());
|
setTimeout(() => resolve(this.getHeroes()), 2000);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// #docregion getHero
|
// #docregion getHero
|
||||||
|
|
Loading…
Reference in New Issue