Fork me on GitHub
#mount
<
2016-07-29
>
jiangts20:07:58

in clojurescript, can states be named as non-strings?

jiangts20:07:14

names the app.audit-log/log state as a string like this: (js/setTimeout #(mount/stop-except "#'app.audit-log/log") 500)

tolitius20:07:43

@jiangts: the reason it is a string is because in :advanced cljs compilation mode, #'app.audit-log/log (as a "non string") would not work, since the app.audit-log namespace will be "optimized" into something like a.b, hence the state won't be found. whereas a string version of it will never change. is there a reason you would need them as non strings?

jiangts21:07:47

ah, gotcha. I was actually hoping to conceal some of my namespaces in the resulting output

tolitius21:07:42

@jiangts: you mean in the logs?

jiangts21:07:59

err, in the final js output

tolitius21:07:32

I might not be following.. where is this output go to?

jiangts21:07:01

like, after running the :advanced compile, a js file is produced

tolitius21:07:06

usually it is useful to have explicit "ns/state", to avoid confusion what comes from where

tolitius21:07:15

a.. ok, to minimize the js

tolitius21:07:28

how many states do you have?

tolitius21:07:47

why so many? and how many is a lot?

jiangts21:07:09

haha, using it in clojurescript to manage all sorts of things ranging from dom event listeners to setIntervals to setTimeouts to atom watches

jiangts21:07:39

i'm writing a plugin javascript application where all the listeners attached to the DOM/js state need to be start-able and stoppable

jiangts21:07:06

a lot is maybe like, 50 or so states

jiangts21:07:18

but as the application grows, the # of states will likely also grow

tolitius21:07:39

might be an interesting mental exercise to figure out how to optimize the names. (not saying it is easily done, but still..) could you open an issue: i.e. something like "cljs: optimize state names in :advance mode"?

tolitius21:07:17

I'll think about it meanwhile.. js world and :advanced mode are quite hairy

jiangts21:07:52

haha, yes they are! cljs is my beacon of hope in a crazy front-end world 🙂

jiangts21:07:05

sounds good on the issue

tolitius21:07:10

great, thanks