hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
2018-03-25T06:59:55.000018Z

(ns infinite-scroll.javelin
 (:require
  hoplon.jquery
  [javelin.core :as j]))

(defn -infinite-scroll-cell
 ([] (-infinite-scroll-cell nil))
 ([threshold]
  (j/with-let [c (j/cell nil)]
   ; <https://gist.github.com/tibbon/6222633>
   (let [win (js/jQuery js/window)
         doc (js/jQuery js/document)
         threshold (or threshold 0)]
    (.on
     win
     (str "scroll." (gensym))
     (fn [e]
      (reset! c
       (&lt;=
        (- (.height doc) threshold)
        (+ (.height win) (.scrollTop win))))))))))
(def infinite-scroll-cell (memoize -infinite-scroll-cell))

2018-03-25T07:00:09.000145Z

infinite scroll in a cell...