Permalink
Browse files

Remove outlet code.

  • Loading branch information...
1 parent 80a5d64 commit 86264cd119c6e16c776559e184da4b641c1de181 @cmeiklejohn committed Mar 13, 2013
Showing with 1 addition and 107 deletions.
  1. +1 −21 src/cljs/shafty/core.cljs
  2. +0 −40 src/cljs/shafty/examples/autosave.cljs
  3. +0 −46 src/cljs/shafty/examples/elapsed.cljs
View
22 src/cljs/shafty/core.cljs
@@ -23,11 +23,6 @@
(remove-sink! [this that])
(propagate! [this value]))
-(defprotocol IRenderable
- "Renders content into the DOM from streams."
- (insert! [this element])
- (add-outlet! [this that]))
-
(defprotocol IBehaviourConversion
"Convert an event stream into a behaviour initializing with a default
value."
@@ -337,22 +332,7 @@
(lift2! [this that lift-fn initial]
(-> (merge! (changes! this) (changes! that))
(map! (fn [] (apply lift-fn [@this @that])))
- (hold! initial)))
-
- IRenderable
- (insert! [this element]
- (-> (add-outlet! this element)
- (propagate! (deref this))) this)
-
- (add-outlet! [this that]
- (set! (.-outlets this) (conj (.-outlets this) that)) this))
-
-(extend-type js/HTMLElement
- IObservable
- (behaviour! [this initial]
- (-> (events! this ["change" "keyup"])
- (hold! initial)
- (insert! this))))
+ (hold! initial))))
;;
;; Priority Map
View
40 src/cljs/shafty/examples/autosave.cljs
@@ -1,40 +0,0 @@
-;; Copyright (c) Christopher Meiklejohn. All rights reserved.
-;;
-;; The use and distribution terms for this software are covered by the
-;; Eclipse Public License 1.0 which can be found in the file
-;; LICENSE.html at the root of this distribution. By using this
-;; software in any fashion, you are agreeing to be bound by the terms of
-;; this license. You must not remove this notice, or any other, from
-;; this software.
-;;
-;; Autosave example.
-;;
-;; Example similar to the example in Section 2.3 of the Flapjax paper.
-;;
-(ns shafty.examples.autosave
- (:use [shafty.core :only [merge! map! snapshot! event! behaviour!
- requests! insert! timer!]]
- [clojure.browser.dom :only [get-element]]))
-
-(defn- build-request [value]
- "Generate a request object."
- { :url "/save" :data { :value value } :method "post" })
-
-(defn- live-content []
- "Generate a behaviour for the live content area."
- (behaviour! (get-element "live-content") nil))
-
-(defn- timer []
- "Generate a timer."
- (-> (timer! 10000 (fn [] (js/Date.)))
- (map! (fn [x] (.log js/console "Timer ticked.") x))))
-
-(defn main []
- "Run the autosave example."
- (-> (event! (get-element "save-button") "click")
- (map! (fn [x] (.log js/console "Button clicked.") x))
- (merge! (timer))
- (snapshot! (live-content))
- (map! build-request)
- (requests!))
- (.log js/console "Starting the autosave example."))
View
46 src/cljs/shafty/examples/elapsed.cljs
@@ -1,46 +0,0 @@
-;; Copyright (c) Christopher Meiklejohn. All rights reserved.
-;;
-;; The use and distribution terms for this software are covered by the
-;; Eclipse Public License 1.0 which can be found in the file
-;; LICENSE.html at the root of this distribution. By using this
-;; software in any fashion, you are agreeing to be bound by the terms of
-;; this license. You must not remove this notice, or any other, from
-;; this software.
-;;
-;; Elapsed timer example.
-;;
-;; Example similar to the example in Section 2.2 of the Flapjax paper.
-;;
-;; var nowB = timerB(1000);
-;; var startTm = nowB.valueNow();
-;; var clickTmsB = $E("reset", "click").snapshotE(nowB)
-;; .startsWith(startTm);
-;; var elapsedB = nowB - clickTmsB;
-;; insertValueB(elapsedB, "curTime", "innerHTML");
-;;
-(ns shafty.examples.elapsed
- (:use [shafty.core :only [merge! map! snapshot! hold! event! requests!
- insert! lift! lift2! timer!]]
- [clojure.browser.dom :only [get-element]]))
-
-(defn- timer []
- "Generate a timer, and convert the timer into a behaviour."
- (-> (timer! 1000 (fn [] (js/Date.)))
- (map! (fn [x] (.log js/console (str "Timer ticked at: " x)) x))
- (hold! (js/Date.))))
-
-(defn- reset [timer]
- "Generate a behaviour originating from click events on the reset
- button. When clicked, snapshot the current state of the timer."
- (-> (event! (get-element "reset-button") "click")
- (snapshot! timer)
- (map! (fn [x] (.log js/console (str "Reset button clicked at: " x)) x))
- (hold! (js/Date.))))
-
-(defn main []
- "Run the elapsed time example."
- (let [the-timer (timer)
- reset-button (reset the-timer)]
- (-> (lift2! the-timer reset-button (fn [now click] (- now click)) 0)
- (insert! (get-element "elapsed"))))
- (.log js/console "Starting the elapsed time example."))

0 comments on commit 86264cd

Please sign in to comment.