Permalink
Browse files

Add switch!

  • Loading branch information...
1 parent b160cd3 commit de0a1ea19f085ae13248ee02078251bbb275e664 @cmeiklejohn committed Mar 13, 2013
Showing with 5 additions and 1 deletion.
  1. +1 −1 README.md
  2. +4 −0 src/cljs/shafty/core.cljs
View
@@ -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!
@@ -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))

0 comments on commit de0a1ea

Please sign in to comment.