This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-28
Channels
- # beginners (45)
- # boot (4)
- # cider (5)
- # cljs-dev (8)
- # cljsrn (4)
- # clojure (38)
- # clojure-conj (7)
- # clojure-dev (4)
- # clojure-russia (3)
- # clojure-spec (20)
- # clojure-uk (3)
- # clojurescript (28)
- # core-logic (29)
- # figwheel-main (10)
- # fulcro (2)
- # onyx (1)
- # other-languages (5)
- # parinfer (3)
- # pathom (98)
- # portkey (1)
- # reagent (15)
- # reitit (9)
- # shadow-cljs (22)
- # spacemacs (10)
- # sql (22)
- # tools-deps (1)
I am having trouble with boot-reload in my clojurescript project. I am storing the game state in an atom. I want the game to reset to the starting state upon reload. The game loop uses setInterval to make a timer. When my code reloads it seems to wipe out the game state before calling my function that I set with on-jsload and that makes me lose track of the timer. Is there a way to run a function to clear the game state before reloading?
@clojureslack how is your atom defined? I believe defonce for the atom instead of def will do what you want.