Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add switch!

  • Loading branch information...
commit de0a1ea19f085ae13248ee02078251bbb275e664 1 parent b160cd3
@cmeiklejohn authored
Showing with 5 additions and 1 deletion.
  1. +1 −1  README.md
  2. +4 −0 src/cljs/shafty/core.cljs
View
2  README.md
@@ -43,7 +43,7 @@ filterE | filter! | sendBehavior |
onceE | once! | liftB |
skipFirstE | skip-first! | notB |
collectE | collect! | blindB |
-switchE | | calmB |
+switchE | switch! | calmB |
delayE | delay!
snapshotE | snapshot!
filterRepeatsE | filter-repeats!
View
4 src/cljs/shafty/core.cljs
@@ -66,6 +66,7 @@
(not! [this])
(map! [this map-fn])
(bind! [this value-fn])
+ (switch! [this])
(once! [this])
(delay! [this interval])
(calm! [this interval])
@@ -156,6 +157,9 @@
(let [e (event [this] (fn [me x] (apply map-fn [(.-value x)])))]
(add-sink! this e) e))
+ (switch! [this]
+ (bind! this (fn [x])))
+
(bind! [this value-fn]
(let [prev (atom false)
out (event [] (fn [me x] x))
Please sign in to comment.
Something went wrong with that request. Please try again.