(defn debug-cljs-devtools
"This is a drop-in alternative for the offical re-frame `debug` middleware
It is better because:
- it writes data, rather than strings, to js/console. This better leverages
the power of cljs-devtols.
- it exploits js/console's ability to colorize text, hopefully making the
output easier to grok."
[handler]
(fn debug-handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Auto-scrolling ============================================================== | |
| (defn scroll! [el start end time] | |
| (.play (goog.fx.dom.Scroll. el (clj->js start) (clj->js end) time))) | |
| (defn scrolled-to-end? [el tolerance] | |
| ;; at-end?: element.scrollHeight - element.scrollTop === element.clientHeight | |
| (> tolerance (- (.-scrollHeight el) (.-scrollTop el) (.-clientHeight el)))) | |
| (defn autoscroll-list [{:keys [children class scroll?] :as opts}] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns views.infinite-scroll | |
| (:require | |
| [reagent.core :as r])) | |
| (defn- get-scroll-top [] | |
| (if (exists? (.-pageYOffset js/window)) | |
| (.-pageYOffset js/window) | |
| (.-scrollTop (or (.-documentElement js/document) | |
| (.-parentNode (.-body js/document)) | |
| (.-body js/document))))) |
OlderNewer