From b15923d25e9b599bb3285cccb53becdb8b2f4672 Mon Sep 17 00:00:00 2001 From: Cameron Ball Date: Sun, 15 Mar 2020 00:22:32 +0800 Subject: [PATCH] Fully wire up promise example, add another one with reject/left --- index.html | 58 +++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/index.html b/index.html index 5c802df..aee2f0f 100644 --- a/index.html +++ b/index.html @@ -37,6 +37,7 @@ font-family: 'Press Start 2P', cursive; text-shadow: 2px 2px 0 #000; font-size: 30px; + overflow: hidden; } h1 { @@ -119,8 +120,13 @@ } span[class^="code-friends"].on { - color: #f98012; + color: #f98012 !important; + } + + span[class^="code-friends"].on > span { + color: #f98012 !important; } + @@ -181,13 +187,28 @@
=<< Promises >>=

JavaScript

-
Promise.resolve("We start here")
-    .then(x => Promise.resolve(x + " then get here"))
-    .then(x => Promise.resolve(x + " and finally here!"))
+
Promise.resolve("We start here")
+    .then(x => Promise.resolve(x + " then get here"))
+    .then(x => Promise.resolve(x + " and finally here!"))

Haskell

-
Right("We start here")
-                >>= (\x -> Right (x ++ " then get here"))
-            >>= (\x -> Right (x ++ " and finally here!"))
+
Right("We start here")
+            >>= (\x -> Right (x ++ " then get here"))
+            >>= (\x -> Right (x ++ " and finally here!"))
+
+ +
+
=<< Promises >>=
+
+

JavaScript

+
Promise.resolve("We start here")
+    .then(x => Promise.resolve(x + " then get here"))
+    .then(x => Promise.reject("Oh noes!"))
+    .then(x => Promise.resolve(x + " and finally here!"))
+

Haskell

+
Right("We start here")
+            >>= (\x -> Right (x ++ " then get here"))
+            >>= (\x -> Left("Oh noes!"))
+            >>= (\x -> Right (x ++ " and finally here!"))
@@ -258,22 +279,21 @@ function activateFriends(n) { f = document.querySelectorAll('.code-friends' + n); - f[0].classList.add("shake-constant"); - f[0].classList.add("shake-slow"); - f[0].classList.add("on"); - f[1].classList.add("shake-constant"); - f[1].classList.add("shake-slow"); - f[1].classList.add("on"); + + for (fr = 0; fr< f.length; fr++) { + f[fr].classList.add("shake-constant"); + f[fr].classList.add("shake-slow"); + f[fr].classList.add("on"); + } } function deactivateFriends(n) { f = document.querySelectorAll('.code-friends' + n); - f[0].classList.remove("shake-constant"); - f[0].classList.remove("shake-slow"); - f[0].classList.remove("on"); - f[1].classList.remove("shake-constant"); - f[1].classList.remove("shake-slow"); - f[1].classList.remove("on"); + for (fr = 0; fr< f.length; fr++) { + f[fr].classList.remove("shake-constant"); + f[fr].classList.remove("shake-slow"); + f[fr].classList.remove("on"); + } } cloudGuyQuotes = [ -- 2.11.0