       (put! output-chan packets
             (fn [result]
               (when result
-                (println (count packets) parse-chunk-size (>= (count packets) parse-chunk-size))
-  ;;              (setImmediate #(parse-loop-async parser output-chan))
-
-            ;;    (if (>= (count packets) parse-chunk-size)
+                (if (>= (count packets) parse-chunk-size)
                   (setImmediate #(parse-loop-async parser output-chan))
-              ;;    )
-
-;;                 (if (>= (count packets) parse-chunk-size)
-;;                   (setImmediate #(parse-loop-async parser output-chan))
-;;                   (close! output-chan))
-
-                ))))))
+                  (close! output-chan))))))))

             [tf2demo])
  (:require-macros
   [cljs.core.async.macros :as asyncm :refer [go go-loop]]))

(def obj-proto (js/Object.getPrototypeOf #js {}))

(extend-type js/tf2demo.PacketEntity
  IEncodeClojure
  (-js->clj [x opts]
    (js/Object.setPrototypeOf x obj-proto)
    ))

;; (extend-type js/tf2demo.SendProp
;;   IEncodeClojure
;;   (-js->clj [x opts] (h/plainify x)))
;; (extend-type js/tf2demo.SendPropDefinition
;;   IEncodeClojure
;;   (-js->clj [x opts] (h/plainify x)))
;; (extend-type js/tf2demo.ServerClass
;;   IEncodeClojure
;;   (-js->clj [x opts] (h/plainify x)))


(defn setImmediate [fn] (js/setTimeout fn 50))


            (doseq [p packets]
              (aset chunk @idx p)
              (swap! idx inc))
            (if (and packets (< @idx n))
              (recur)
              @idx)))]
