The :hoplon: ClojureScript Web Framework - http://hoplon.io/
vschepik 2018-04-19T08:46:52.000178Z

@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

vschepik 2018-04-19T13:29:26.000436Z

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?

vschepik 2018-04-19T13:58:15.000730Z

Yes, that looks good!

vschepik 2018-04-19T13:58:46.000190Z

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

vschepik 2018-04-19T14:00:33.000279Z

OK. It's not clear to me what boot-reload reloads. But I will try what you have suggested.


@alandipert ^^

vschepik 2018-04-19T14:16:28.000575Z

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

vschepik 2018-04-19T14:46:51.000576Z

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

vschepik 2018-04-19T14:49:53.000098Z

Yes, defonce is great.

vschepik 2018-04-19T14:50:15.000651Z

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

vschepik 2018-04-19T14:53:50.000330Z

OK, so what would the ns of (page "index.html") be?


i think something like hoplon.app-pages.-index.html

vschepik 2018-04-19T14:56:09.000326Z

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

vschepik 2018-04-19T14:56:17.000062Z



it might be better with a repl involved to not use page or .hl extension, and keep things vanilla cljs

vschepik 2018-04-19T14:58:09.000802Z

OK. Perhaps I don't need the repl since local-storage will help me


https://github.com/hoplon/hoplon#example is an example

vschepik 2018-04-19T15:00:11.000164Z

Now I see the ns expression. Thanks. I will check out what a good workflow could be for me. Thanks!