diff --git a/public/docs/_examples/toh-4/dart/lib/hero_service.dart b/public/docs/_examples/toh-4/dart/lib/hero_service.dart index 30f25f5931..4eff635e4c 100644 --- a/public/docs/_examples/toh-4/dart/lib/hero_service.dart +++ b/public/docs/_examples/toh-4/dart/lib/hero_service.dart @@ -17,7 +17,7 @@ class HeroService { // See the "Take it slow" appendix // #docregion get-heroes-slowly Future> getHeroesSlowly() { - return new Future.delayed(const Duration(seconds: 2), () => mockHeroes); + return new Future.delayed(const Duration(seconds: 2), getHeroes); } // #enddocregion get-heroes-slowly // #docregion diff --git a/public/docs/_examples/toh-4/dart/lib/hero_service_1.dart b/public/docs/_examples/toh-4/dart/lib/hero_service_1.dart index 87e11177d8..6feca85ae0 100644 --- a/public/docs/_examples/toh-4/dart/lib/hero_service_1.dart +++ b/public/docs/_examples/toh-4/dart/lib/hero_service_1.dart @@ -13,7 +13,7 @@ class HeroService { // #enddocregion getHeroes-stub, empty-class, final /* // #docregion getHeroes-stub - List getHeroes() {} + List getHeroes() {} // stub // #enddocregion getHeroes-stub */ // #docregion final diff --git a/public/docs/_examples/toh-4/ts/app/hero.service.1.ts b/public/docs/_examples/toh-4/ts/app/hero.service.1.ts index 15e4c44285..2366215259 100644 --- a/public/docs/_examples/toh-4/ts/app/hero.service.1.ts +++ b/public/docs/_examples/toh-4/ts/app/hero.service.1.ts @@ -13,8 +13,7 @@ export class HeroService { // #enddocregion empty-class, getHeroes-stub, full /* // #docregion getHeroes-stub - getHeroes(): void { - } + getHeroes(): void {} // stub // #enddocregion getHeroes-stub */ // #docregion full 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 01272c1395..2b4de81c39 100644 --- a/public/docs/_examples/toh-4/ts/app/hero.service.ts +++ b/public/docs/_examples/toh-4/ts/app/hero.service.ts @@ -18,8 +18,8 @@ export class HeroService { // #docregion get-heroes-slowly getHeroesSlowly(): Promise { return new Promise(resolve => - setTimeout(() => resolve(HEROES), 2000) // 2 seconds - ); + setTimeout(resolve, 2000)) // delay 2 seconds + .then(() => this.getHeroes()); } // #enddocregion get-heroes-slowly // #docregion diff --git a/public/docs/_examples/toh-5/dart/lib/hero_service.dart b/public/docs/_examples/toh-5/dart/lib/hero_service.dart index b8e04a67c6..aca9e3c21d 100644 --- a/public/docs/_examples/toh-5/dart/lib/hero_service.dart +++ b/public/docs/_examples/toh-5/dart/lib/hero_service.dart @@ -10,10 +10,9 @@ import 'mock_heroes.dart'; class HeroService { Future> getHeroes() async => mockHeroes; - // See the "Take it slow" appendix Future> getHeroesSlowly() { return new Future>.delayed( - const Duration(seconds: 2), () => mockHeroes); + const Duration(seconds: 2), getHeroes); } // #docregion getHero 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 67215fb228..163734fe5f 100644 --- a/public/docs/_examples/toh-5/ts/app/hero.service.ts +++ b/public/docs/_examples/toh-5/ts/app/hero.service.ts @@ -10,11 +10,10 @@ export class HeroService { return Promise.resolve(HEROES); } - // See the "Take it slow" appendix getHeroesSlowly(): Promise { return new Promise(resolve => - setTimeout(() => resolve(HEROES), 2000) // 2 seconds - ); + setTimeout(resolve, 2000)) // delay 2 seconds + .then(() => this.getHeroes()); } // #docregion getHero