This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-30
Channels
- # beginners (32)
- # boot (15)
- # cljs-dev (200)
- # cljsjs (1)
- # cljsrn (18)
- # clojure (4)
- # clojure-austin (2)
- # clojure-spec (6)
- # clojure-uk (8)
- # clojurescript (69)
- # cloverage (1)
- # cursive (12)
- # datomic (1)
- # dirac (37)
- # emacs (1)
- # hoplon (38)
- # off-topic (3)
- # om (19)
- # om-next (1)
- # onyx (4)
- # parinfer (2)
- # perun (27)
- # protorepl (4)
- # re-frame (5)
- # rum (9)
- # spacemacs (8)
- # untangled (2)
@mynomoto: is there a repo somewhere?
@mynomoto: can you try boot-hoplon 0.2.5 and/or hoplon-alpha15 then go from there?
It might also be a problem with cljs 1.9.293 I can play with it soon just on mobile right now
boot-hoplon 0.2.5
and hoplon alpha15
have the same problem. Am I the first to have this issue? That seems odd. I have to go now but will keep going back to see if I can find when this started. I haven't used boot-hoplon in a while, I was manually mounting without problems.
is there a cell in hoplon core that tracks the viewport size?
no. but you can easily make one, something like:
(defn resize-cell []
(with-let [size (cell [])]
(.addEventListener js/window "resize" #(reset! size (vector (.-innerWidth js/window) (.-innerHeight js/window))))))
@thedavidmeister: consider that pseudocode, i've not tried it.
@jumblerg looks good to me 🙂
i went with a map, but the idea is the same
(defn window-size
[]
{:height (.-innerHeight js/window)
:width (.-innerWidth js/window)})
(defn size-cell
[]
(let [c (j/cell (window-size))]
(j/with-let [_ (j/cell= c)]
(-> js/window
(.addEventListener "resize" #(reset! c (window-size)))))))
looks good too. if i wanted to use named values instead of positional coordinates i might stick the window object itself in the cell.
@jumblerg i tried this
(defn size-cell
[]
(let [c (j/cell js/window)]
(j/with-let [_ (j/cell= { :height (.-innerHeight c)
:width (.-innerWidth c)})]
(-> js/window
(.addEventListener "resize" #(reset! c js/window))))))
didn’t seem to work
i guess because (reset! c js/window)
doesn’t make c
equal to something new so it doesn’t propagate the value through the formula cells?
@thedavidmeister you can do like (j/cell [js/window 0])
@flyboarder can reproduce the append on reload problem as far as hoplon alpha7 and boot-hoplon 0.1.5 and boot-reload 0.4.10, not sure of what else to test.
I'll take another look
it's -ing
@mynomoto I see the problem
it's not the libraries
it's the app
So you can't reload a file that does (def myelem (hl/some-elem))
since the hlisp element returns a constructor you are actually creating the element again on reload, you want those to all be defn
so the elements are only created when called within (html)
does that make sense?
I would recommend using defelem
for those
@flyboarder I don't think this is what's going on. This could cause some things disappearing from the old ones as it's stolen by the new thing appended. But whats being appended is not in a def
, it's inlined.
I don't think you want to inline like that, the elements are created outside of HTML
block which isn't what you want
@mynomoto yeah i got it working by changing all of the layout stuff and passing the kids through
@flyboarder make everything a function worked, thanks.
But this is related to the way things are getting mounted, I don't have that problem mounting manually.
when you def
the element is constructed (when the ns is loaded), when it's defn
it's delayed until the fn is called
so on subsequent reloads the element is already mounted somewhere, the new version then gets appended there