This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-24
Channels
- # announcements (6)
- # babashka (25)
- # beginners (52)
- # cherry (8)
- # cider (9)
- # clj-kondo (9)
- # clojure (44)
- # clojure-australia (5)
- # clojure-dev (4)
- # clojure-europe (8)
- # clojure-nl (5)
- # clojure-norway (3)
- # clojure-spec (3)
- # clojure-uk (1)
- # clojurescript (16)
- # conjure (1)
- # core-async (8)
- # cursive (11)
- # fulcro (13)
- # honeysql (6)
- # hyperfiddle (13)
- # jackdaw (1)
- # jobs (9)
- # lsp (13)
- # meander (5)
- # missionary (2)
- # off-topic (11)
- # polylith (11)
- # re-frame (2)
- # reitit (11)
- # shadow-cljs (69)
- # squint (23)
- # tools-deps (30)
- # xtdb (3)
Noticed I don’t need dom/div and p/defn works for the button, planning to use ngrok to demo to company in 10% time later 🙂
would you like to contribute it to the demos folder? we are considering making tic tac toe the first tutorial homework
how did it go? what rough edges did you hit
Just issues that have already been fixed, when I started the if statement returning x or o wasn’t working correctly (that’s been fixed since), I was able to remove (dom/text) during development and I didn’t understand (defn button returns an object (you helped me fix that) I’m still a bit fuzzy on (fn []) style functions the docs say it isn’t supported yet but not too worried about it right now
PR here: https://github.com/hyperfiddle/photon/pull/14 going to continue to develop it in another file locally but after adding features I doubt it will be this small again
I didn’t notice the snake game till now that looks cool
Found something interesting, I had a bug where I was trying to do (dom/input) on the page that renders ok the page (you see an input box and respects settings like ::dom/placeholder or :placeholder, I was trying to do ::ui/keychord-event based on the chat demo but couldn’t get it working and didn’t notice that I needed (ui/input) because (dom/input appeared to be 90% working
I think I need to better understand the differences between those namespaces
ui/input and dom/input have been proposed to be collapsed into just photon-dom
historically, dom/input is a low level dom wrapper and ui/input is higher level abstractions that match Photon idioms
To clarify the difference between clojure.core/fn and photon/fn,
(ui/button {::ui/click-event (p/fn [_]
(p/server (swap! !x (fn [board pos]
(update board pos #(case % 0 1, 1 2, 2 0))) offset)))})
this does not work today (using clojure.core/fn inside a p/fn region) but is well defined – we hope to implement this soon. For now you have to factor out the cc/fn today as you did :
(defn update-board! [board pos] (update board pos #(case % 0 1, 1 2, 2 0)))
(ui/button {::ui/click-event (p/fn [_]
(p/server (swap! !x update-board offset)))})
p/fn and cc/fn are different types