             (doseq [p packets]
               (aset chunk @idx p)
               (swap! idx inc))
-;;             (println "loopin loopin" @idx n (not packets) (and packets (< @idx n)))
             (if (and packets (< @idx n))
               (recur)
               @idx)))]

        (doseq [p packets] (.emit parser "packet" p))
        (when packets
          (.map packets (fn [p] (js-delete p "tables"))))
        packets))))

;; parse the next messages to get at least n packets (may return more than
;; the requested n packets), or until end of parser

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

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

