@alandipert Yes, it is confusing how the compilation model in cljs and the REPL can co-exist. But I will go for your advice. I also learned to love the debux lib that is simple and powerful for pretty printing stuff in the console.
i just wrote this time syncing algo for javelin - https://github.com/thedavidmeister/javelin-timesync - for anyone who wants to sync UIs across devices
Is there any way to save the state of a Javelin cell when boot-reload reloads the JS code? The reason is that I am storing responses of REST calls in a cell and do not want to call the REST endpoint everytime I hit Save in my editor.
@vschepik hoplon.storage-cell
you can stick it in session storage or local storage
is that what you're asking?
Yes, that looks good!
I will try that
(defonce state (hoplon.storage-atom/local-storage (j/cell nil) ::state))
(defonce nonce (hoplon.storage-atom/local-storage (j/cell nil) ::nonce))
(defonce token (hoplon.storage-atom/local-storage (j/cell nil) ::token))
this kind of thing
also you can memoize functions that return cells and get the same cell every time
you might find that handy
OK. It's not clear to me what boot-reload reloads. But I will try what you have suggested.
@alandipert ^^
That was exactly what I was looking for 😃 Thanks!
another thing i will do is comment out the code that fetches the value, and hardcode it
I did this in a different non-Hoplon project, too. But for that I had Emacs connected to a cljs repl in order to fetch the value directly into the editor. With Hoplon I had problems to get the cljs repl running but now it works.
oh, cool
defonce
is probably also better because using local storage or hardcoding require the saved object to be print-readable
Yes, defonce
is great.
By the way what is the namespace of a page
?
it's not a macro or a function, it's compiled to ns
by the hoplon boot task. in hoplon.boot-hoplon.compiler
well, an ns
and conversion to .html
OK, so what would the ns of (page "index.html")
be?
i think something like hoplon.app-pages.-index.html
I am asking because I want to switch to that namespace in the repl.
you can see what it generates with boot hoplon show -f
to see the fileset after hoplon task runs
Great
it might be better with a repl involved to not use page
or .hl
extension, and keep things vanilla cljs
OK. Perhaps I don't need the repl since local-storage
will help me
https://github.com/hoplon/hoplon#example is an example
Now I see the ns
expression. Thanks. I will check out what a good workflow could be for me. Thanks!