Fork me on GitHub
#re-frame
<
2016-04-25
>
mikethompson01:04:09

enable-console-print!only ever needs to be called once

mikethompson01:04:44

And I wasn't ever aware it had to be called after a figwheel reload

mikethompson01:04:13

Sometimes you see enable-console-print! added to namespaces to ensure it is called early enough to be used in the loading of that namespace (<script> loading).

mikethompson01:04:48

For example, I might have a (enable-console-print!) in my core.cljs. BUT this core.cljs might require a.cljs ... which means the code in the a namespace will be "loaded' before any code in core.sljs gets run (including that call to enable-console-print! in core.cljs). AND if a.cljs did some console output during the loading phase (script loading), that output won't appear unless there's a prior enable-console-print! which means it probably as to happen in a.cljs itself.

darwin10:04:36

cljs dependencies are sorted in topological order, and because of that you cannot identify which namespace will be required first to put enable-console-print! there, cljs-devtools has the same issue, ideally it should be installed before any other code which could potentially call console.log or similar. See this paragraph how to do that safely without depending on dependency ordering: https://github.com/binaryage/cljs-devtools/blob/master/docs/install.md#dev-builds

curlyfry20:04:06

Hi, which way would you guys say is the most idiomatic when changing a class on some element in a component based on for example the scrollTop attribute of the element? 1. A reagent atom local to the component (let in form-2 component) containing the class. The value of the atom is changed when the on-scroll event is triggered. 2. Subscribe to the class value from app-db, and dispatch the on-scroll event when triggered.

danielcompton22:04:01

Probably 2. The on-scroll event would dispatch an event which would update app-db