This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-10
Channels
- # aleph (4)
- # beginners (32)
- # cider (12)
- # cljs-dev (56)
- # cljsrn (7)
- # clojars (3)
- # clojure (165)
- # clojure-dev (33)
- # clojure-germany (1)
- # clojure-italy (27)
- # clojure-russia (7)
- # clojure-spec (24)
- # clojure-uk (62)
- # clojurescript (37)
- # core-async (7)
- # core-matrix (1)
- # cursive (9)
- # data-science (8)
- # datomic (8)
- # duct (4)
- # events (1)
- # figwheel (7)
- # flambo (3)
- # fulcro (43)
- # hoplon (25)
- # jobs-discuss (8)
- # lein-figwheel (4)
- # luminus (2)
- # off-topic (35)
- # om (8)
- # om-next (3)
- # onyx (30)
- # pedestal (62)
- # portkey (2)
- # protorepl (2)
- # re-frame (40)
- # reagent (9)
- # shadow-cljs (123)
- # specter (30)
- # sql (22)
- # testing (1)
- # uncomplicate (40)
- # unrepl (3)
- # vim (13)
- # yada (5)
@bravilogy more on side effects http://ingesolvoll.github.io/2017/06/29/re-frame-side-effects-as-data.html
having trouble ending the interval
here 😞
(defonce interval-handler
(fn [{:keys [action id frequency event]}]
(let [live-intervals (atom {})]
(condp = action
:start (swap! live-intervals assoc id (js/setInterval #(re-frame/dispatch event) frequency))
:end (do (js/clearInterval (get live-intervals id))
(js/console.log "clearing interval")
(swap! live-intervals dissoc id))))))
(re-frame/reg-fx
:interval
interval-handler)
(defn start-game [db]
{:interval {:action :start
:id :time-checker
:frequency 1000
:event [:tick]}
:db (-> db
(assoc :is-playing? true)
(refresh-colors))})
(defn end-game [db]
{:interval {:action :end
:id :time-checker}
:db (assoc db :has-ended? true)})
(re-frame/reg-event-fx
:tick
(fn [{:keys [db]}]
(if (> (:time-left db) 1)
{:db (update db :time-left dec)}
(end-game db))))
whenever I call end-game
, it updates the db
but doesn’t end that intervallooks like I needed to deref
live-intervals
and actually there’s that mistake on this page:
@bravilogy thank you, I'll correct that mistake. Remember there is a #re-frame channel
I was reading this:
https://www.braveclojure.com/quests/deploy/
and was wondering if I can connect my repo to Travis CI and deploy JUST the html bit instead, to surge
for example? Instead of having a full nginx setup, as my app is just front end
Can anyone recommend any guides on how to figure out problems with advanced compilation? I'm having a Cannot read property 'c' of null
moment and I don't really know where to start
i think setting https://clojurescript.org/reference/compiler-options#pseudo-names is supposed to help
Thanks so much for :pseudo-names
. I still have no idea what's going on, but now I know which component in my app 🙂
You should also run the compiler in verbose mode and set warn-on-reflection to true depending on how you go about interop
so.. my first ClojureScript app: https://frequent-scarecrow.surge.sh/ and the code: https://github.com/Bravilogy/colours-game-clojure thanks everyone for helping out! 😄
Bravo, @bravilogy 👍
Suggestions (1) since you're using jumbotron as entrance, you might want to jumbo your game look 'n feel too, for the sake of UX, (2) better to reward user for winning the game at some point, like a jumbo You Won of some sort, again, for the sake of UX
Any suggestions for a storage solution in the browser? Storing collections of mostly flat objects
I was using LocalStorage for my app via https://github.com/alandipert/storage-atom. All interesting parts of state were serialized under single key. Now I am migrating to IndexedDB because of performance.
@U662GKS3F how do you like IndexedDB?
@U662GKS3F did you use any library?
@U0HJ8KMH7 only thing I don't like so far is that you cannot write something like WHERE field1 = 3 OR field2 = 5
. You need to make 2 queries and merge them.
@U297WCSHK I didn't. I used the api directly via cljs interop. It looks very ugly and doesn't take into account failures - at least for now. (I am using it only on some project nobody uses and it's main purpose is to play with clj[s]...)
I wonder if https://github.com/dfahlander/Dexie.js is directly consumable with latest compiler improvements, version on cljsjs is pretty dated
I’ve had good luck with using transit to encode objects, and storing the resulting string as LocalStorage
Hi all, I wonder but am not at a computer right now, does hash
under clojurescript produce the same result as clojure for the basic types? If so is this supposed to be a guarantee under some condition? Thanks!
no, it’s not portable between clj and cljs
@noisesmith ok, thanks!
iirc someone made a library to do portable hashes of data that is portable between clj and cljs… I’m not recalling the name though
It's not an issue for me, was just curious, but now I know that will keep me out of trouble later :)