hoplon

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.

2018-04-19T10:03:33.000306Z

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.

2018-04-19T13:56:50.000643Z

@vschepik hoplon.storage-cell

2018-04-19T13:56:57.000542Z

you can stick it in session storage or local storage

2018-04-19T13:57:47.000126Z

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

2018-04-19T13:58:47.000589Z

(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))

2018-04-19T13:58:49.000637Z

this kind of thing

2018-04-19T13:59:18.000538Z

also you can memoize functions that return cells and get the same cell every time

2018-04-19T13:59:25.000494Z

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.

2018-04-19T14:05:40.000491Z

@alandipert ^^

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

That was exactly what I was looking for 😃 Thanks!

2018-04-19T14:39:38.000571Z

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.

2018-04-19T14:48:29.000781Z

oh, cool

2018-04-19T14:49:00.000787Z

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?

2018-04-19T14:52:53.000698Z

it's not a macro or a function, it's compiled to ns by the hoplon boot task. in hoplon.boot-hoplon.compiler

2018-04-19T14:53:29.000729Z

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?

2018-04-19T14:55:46.000828Z

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.

2018-04-19T14:56:10.000256Z

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

Great

2018-04-19T14:56:38.000672Z

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

2018-04-19T14:58:30.000195Z

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!

👍 1