From 94f67f4483a35bdb2ea3b98a3a94212fac64ee97 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 17 Apr 2019 17:47:39 -0400 Subject: [PATCH] ts notes Signed-off-by: Bill Erickson --- tsfun.adoc | 29 +++++++++++++++++++++++++++-- tsfun.html | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/tsfun.adoc b/tsfun.adoc index 5bcfcf2a6..5a673c5af 100644 --- a/tsfun.adoc +++ b/tsfun.adoc @@ -35,12 +35,17 @@ set msg(s: string) { this._msg = s; - this.doImportStuff(); + this.doImportantStuff(); } ------------------------------------------------------------------------- == Setters with Angular Component Inputs +[source,html] +------------------------------------------------------------------------- + +------------------------------------------------------------------------- + [source,javascript] ------------------------------------------------------------------------- @Input() set msg(s: string) { @@ -49,7 +54,7 @@ set msg(s: string) { console.debug('Parent component passed new value for msg', s); - this.doImportStuff(); + this.doImportantStuff(); } ------------------------------------------------------------------------- @@ -72,6 +77,26 @@ modifyCar(): Promise { } ------------------------------------------------------------------------- +== Nesty Version + +[source,javascript] +------------------------------------------------------------------------- +modifyCar(): Promise { + + return this.loadCar().then((car: Car) => { + + this.colorDialog.open(car).then((color: string) => { + + this.applyColor(color).then( + + (cost: number) => this.addCost(cost) + ) + }); + }); +} +------------------------------------------------------------------------- + + == Drum Roll Please 🥁 ... == Converted to Async Functions diff --git a/tsfun.html b/tsfun.html index 7cf684b6a..44ea39375 100644 --- a/tsfun.html +++ b/tsfun.html @@ -3878,7 +3878,7 @@ http://www.gnu.org/software/src-highlite --> this._msg = s; - this.doImportStuff(); + this.doImportantStuff(); } @@ -3890,13 +3890,19 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> +
<my-component [msg]="localMsgVar" ...></my-component>
+
+
@Input() set msg(s: string) {
 
     this._msg = s;
 
     console.debug('Parent component passed new value for msg', s);
 
-    this.doImportStuff();
+    this.doImportantStuff();
 }
@@ -3926,6 +3932,29 @@ http://www.gnu.org/software/src-highlite -->
+

Nesty Version

+
+
+
+
modifyCar(): Promise<CarStuff> {
+
+    return this.loadCar().then((car: Car) => {
+
+        this.colorDialog.open(car).then((color: string) => {
+
+            this.applyColor(color).then(
+
+                (cost: number) => this.addCost(cost)
+            )
+        });
+    });
+}
+
+
+

Drum Roll Please 🥁 …

-- 2.11.0