ts notes collab/berick/eg2019
authorBill Erickson <berickxx@gmail.com>
Wed, 17 Apr 2019 21:47:39 +0000 (17:47 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 17 Apr 2019 21:47:39 +0000 (17:47 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
tsfun.adoc
tsfun.html

index 5bcfcf2..5a673c5 100644 (file)
@@ -35,12 +35,17 @@ set msg(s: string) {
 
     this._msg = s;
 
-    this.doImportStuff();
+    this.doImportantStuff();
 }
 -------------------------------------------------------------------------
 
 == Setters with Angular Component Inputs
 
+[source,html]
+-------------------------------------------------------------------------
+<my-component [msg]="localMsgVar" ...></my-component>
+-------------------------------------------------------------------------
+
 [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<CarStuff> {
 }
 -------------------------------------------------------------------------
 
+== Nesty Version 
+
+[source,javascript]
+-------------------------------------------------------------------------
+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 🥁 ...
 
 == Converted to Async Functions
index 7cf684b..44ea393 100644 (file)
@@ -3878,7 +3878,7 @@ http://www.gnu.org/software/src-highlite -->
 \r
     <span style="font-weight: bold"><span style="color: #0000FF">this</span></span><span style="color: #990000">.</span>_msg <span style="color: #990000">=</span> s<span style="color: #990000">;</span>\r
 \r
-    <span style="font-weight: bold"><span style="color: #0000FF">this</span></span><span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">doImportStuff</span></span><span style="color: #990000">();</span>\r
+    <span style="font-weight: bold"><span style="color: #0000FF">this</span></span><span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">doImportantStuff</span></span><span style="color: #990000">();</span>\r
 <span style="color: #FF0000">}</span></tt></pre></div></div>\r
 </div>\r
 </div>\r
@@ -3890,13 +3890,19 @@ http://www.gnu.org/software/src-highlite -->
 by Lorenzo Bettini\r
 http://www.lorenzobettini.it\r
 http://www.gnu.org/software/src-highlite -->\r
+<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;my-component</span></span> <span style="color: #009900">[msg]</span><span style="color: #990000">=</span><span style="color: #FF0000">"localMsgVar"</span> ...<span style="font-weight: bold"><span style="color: #0000FF">&gt;&lt;/my-component&gt;</span></span></tt></pre></div></div>\r
+<div class="listingblock">\r
+<div class="content"><!-- Generator: GNU source-highlight\r
+by Lorenzo Bettini\r
+http://www.lorenzobettini.it\r
+http://www.gnu.org/software/src-highlite -->\r
 <pre><tt>@<span style="font-weight: bold"><span style="color: #000000">Input</span></span><span style="color: #990000">()</span> set <span style="font-weight: bold"><span style="color: #000000">msg</span></span><span style="color: #990000">(</span>s<span style="color: #990000">:</span> string<span style="color: #990000">)</span> <span style="color: #FF0000">{</span>\r
 \r
     <span style="font-weight: bold"><span style="color: #0000FF">this</span></span><span style="color: #990000">.</span>_msg <span style="color: #990000">=</span> s<span style="color: #990000">;</span>\r
 \r
     console<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">debug</span></span><span style="color: #990000">(</span><span style="color: #FF0000">'Parent component passed new value for msg'</span><span style="color: #990000">,</span> s<span style="color: #990000">);</span>\r
 \r
-    <span style="font-weight: bold"><span style="color: #0000FF">this</span></span><span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">doImportStuff</span></span><span style="color: #990000">();</span>\r
+    <span style="font-weight: bold"><span style="color: #0000FF">this</span></span><span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">doImportantStuff</span></span><span style="color: #990000">();</span>\r
 <span style="color: #FF0000">}</span></tt></pre></div></div>\r
 </div>\r
 </div>\r
@@ -3926,6 +3932,29 @@ http://www.gnu.org/software/src-highlite -->
 </div>\r
 </div>\r
 <div class="sect1 slide">\r
+<h1 id="_nesty_version">Nesty Version</h1>\r
+<div class="sectionbody" style="max-width:45em">\r
+<div class="listingblock">\r
+<div class="content"><!-- Generator: GNU source-highlight\r
+by Lorenzo Bettini\r
+http://www.lorenzobettini.it\r
+http://www.gnu.org/software/src-highlite -->\r
+<pre><tt><span style="font-weight: bold"><span style="color: #000000">modifyCar</span></span><span style="color: #990000">():</span> Promise<span style="color: #990000">&lt;</span>CarStuff<span style="color: #990000">&gt;</span> <span style="color: #FF0000">{</span>\r
+\r
+    <span style="font-weight: bold"><span style="color: #0000FF">return</span></span> <span style="font-weight: bold"><span style="color: #0000FF">this</span></span><span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">loadCar</span></span><span style="color: #990000">().</span><span style="font-weight: bold"><span style="color: #000000">then</span></span><span style="color: #990000">((</span>car<span style="color: #990000">:</span> Car<span style="color: #990000">)</span> <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">{</span>\r
+\r
+        <span style="font-weight: bold"><span style="color: #0000FF">this</span></span><span style="color: #990000">.</span>colorDialog<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">open</span></span><span style="color: #990000">(</span>car<span style="color: #990000">).</span><span style="font-weight: bold"><span style="color: #000000">then</span></span><span style="color: #990000">((</span>color<span style="color: #990000">:</span> string<span style="color: #990000">)</span> <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">{</span>\r
+\r
+            <span style="font-weight: bold"><span style="color: #0000FF">this</span></span><span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">applyColor</span></span><span style="color: #990000">(</span>color<span style="color: #990000">).</span><span style="font-weight: bold"><span style="color: #000000">then</span></span><span style="color: #990000">(</span>\r
+\r
+                <span style="color: #990000">(</span>cost<span style="color: #990000">:</span> number<span style="color: #990000">)</span> <span style="color: #990000">=&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">this</span></span><span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">addCost</span></span><span style="color: #990000">(</span>cost<span style="color: #990000">)</span>\r
+            <span style="color: #990000">)</span>\r
+        <span style="color: #FF0000">}</span><span style="color: #990000">);</span>\r
+    <span style="color: #FF0000">}</span><span style="color: #990000">);</span>\r
+<span style="color: #FF0000">}</span></tt></pre></div></div>\r
+</div>\r
+</div>\r
+<div class="sect1 slide">\r
 <h1 id="_drum_roll_please_8230">Drum Roll Please 🥁 &#8230;</h1>\r
 <div class="sectionbody" style="max-width:45em">\r
 </div>\r