From d826eb1edae493831b40bce0bbc67014e21973c0 Mon Sep 17 00:00:00 2001 From: Cameron Ball Date: Fri, 13 Mar 2020 00:35:26 +0800 Subject: [PATCH] Start wiring up promise example --- index.html | 56 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index fb60f18..3312a54 100644 --- a/index.html +++ b/index.html @@ -3,8 +3,8 @@ - + href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/default.min.css"> + Crazy Wide-Eyed Functional Programming @@ -125,7 +129,12 @@
=<< The Third Slide >>=
-
Left "Hello" >>= \x -> Right "ah shit"
+
Promise.resolve("We start here")
+    .then(x => Promise.resolve(x + " then get here"))
+    .then(x => Promise.resolve(x + " and finally here!"))
+
Right("We start here")
+    >>= (\x -> Right (x ++ " then get here"))
+    >>= (\x -> Right (x ++ " and finally here!"))
@@ -192,5 +201,24 @@ } })(); + 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"); + } + + 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"); + } -- 2.11.0