diff --git a/public/docs/_examples/toh-4/ts/app/hero.service.ts b/public/docs/_examples/toh-4/ts/app/hero.service.ts index 2b4de81c39..03a1c10a4a 100644 --- a/public/docs/_examples/toh-4/ts/app/hero.service.ts +++ b/public/docs/_examples/toh-4/ts/app/hero.service.ts @@ -14,12 +14,14 @@ export class HeroService { } // #enddocregion get-heroes, just-get-heroes // #enddocregion + // See the "Take it slow" appendix // #docregion get-heroes-slowly getHeroesSlowly(): Promise { - return new Promise(resolve => - setTimeout(resolve, 2000)) // delay 2 seconds - .then(() => this.getHeroes()); + return new Promise(resolve => { + // Simulate server latency with 2 second delay + setTimeout(() => resolve(this.getHeroes()), 2000); + }); } // #enddocregion get-heroes-slowly // #docregion diff --git a/public/docs/_examples/toh-5/ts/app/hero.service.ts b/public/docs/_examples/toh-5/ts/app/hero.service.ts index 163734fe5f..ee5a684762 100644 --- a/public/docs/_examples/toh-5/ts/app/hero.service.ts +++ b/public/docs/_examples/toh-5/ts/app/hero.service.ts @@ -11,9 +11,10 @@ export class HeroService { } getHeroesSlowly(): Promise { - return new Promise(resolve => - setTimeout(resolve, 2000)) // delay 2 seconds - .then(() => this.getHeroes()); + return new Promise(resolve => { + // Simulate server latency with 2 second delay + setTimeout(() => resolve(this.getHeroes()), 2000); + }); } // #docregion getHero