jimpil / duratom

A durable atom type for Clojure
Eclipse Public License 1.0
213 stars 14 forks source link

Idea: cljc + localStorage backend = cljs duratom bliss #8

Closed harold closed 6 years ago

harold commented 6 years ago

What do you think about moving the necessary namespaces to cljc and implementing a backend on top of browser localStorage (https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API)? Then we would have client side duratom.

Is it a silly idea?

aiba commented 6 years ago

FWIW, I currently use alandipert/storage-atom for a cljs atom backed by localStorage.

harold commented 6 years ago

Neat! Thanks.

jimpil commented 6 years ago

That's certainly an interesting idea, but I'm not sure to what extent it is feasible and/or even desirable. Looking at storage-atom, I can see that its author chose to maintain different libraries for clj VS cljs. I suspect there is a good reason for that. In any case, I will try to think about this a bit more, because I have to admit that you caught me somewhat off guard (i.e. I wasn't aware of localStorage and I've never used cljc). Thanks :)

harold commented 6 years ago

Sounds smart to me! Thanks again for this terrific library, I love it.