         ch  (chan)]
     (.send req nil #(put! ch %))
     (go (let [[v c] (alts! [t ch])]
-          (case
+          (cond
             ; timeout
             (= c t)
             (>! ajax-chan {:error :timeout})

            (not (= (.. v -meta -status) 200))
            (>! ajax-chan {:error :ajax})
            ; response OK
            (let [items (-> (.. v -response)
                            (js->clj :keywordize-keys true)
                            (#(filter #(= (:type %) "photo"))))]
              (>! ajax-chan {:error false
                             :search-term search-term
                             :items items})))))))

(ns tumblrsearch.search
  (:require 
    [cljs.core.async :as async :refer [put! chan >! <! alts! timeout]]
    [om.core :as om :include-macros true])
  (:require-macros [cljs.core.async.macros :refer [go]])
  (:import [goog.net Jsonp]
           [goog Uri]))

