This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-13
Channels
- # beginners (202)
- # boot (7)
- # cider (14)
- # clara (2)
- # cljs-dev (7)
- # clojure (56)
- # clojure-italy (9)
- # clojure-spec (6)
- # clojure-uk (12)
- # clojurescript (40)
- # core-async (3)
- # datomic (6)
- # duct (1)
- # editors (10)
- # emacs (5)
- # fulcro (24)
- # off-topic (16)
- # onyx (4)
- # pedestal (1)
- # planck (8)
- # portkey (2)
- # re-frame (31)
- # reagent (23)
- # tools-deps (8)
- # vim (3)
I'm making a small Sokoban game in ClojureScript (using re-frame), and I want some way of "simulating" cursor key movement on a touchscreen. I.e. I want an event to trigger when the player presses the left part of the screen etc... Do I need to create some big overlapping divs, or are there other ways?
In traditional js ,this is done by having event bubbling/propagation, allowing the window handler to have an event on it. http://www.javascripter.net/faq/eventbubbling.htm might be useful.
@zalky That's how interop is done in Clojure/Clojurescript, no? I've only seen and used the first way. I've never seen nor used the second way.
I'm trying to use an existing React component with Reagent. Unfortunately, I'm having some trouble getting it loaded. In my page template:
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ReactPlayer.js"></script>
{% script "/js/app.js" %}
(`app.js` being my transpiled clojurescipt, the tag above being the react component)
As you'd expect, the React component depends on React, but React is not defined when it's loaded, so it errors.@vheuken I'd recommend shadow-cljs for using js libraries in clojurescript. Here's a good gist if you want to evaluate more options: https://gist.github.com/jmlsf/f41b46c43a31224f46a41b361356f04d
Is Code Splitting something that is often used in larger ClojureScript applications? I got a question about it in a Clojure workshop but since I (mostly) don't do UI stuff I didn't have a good answer. My first reaction was that perhaps when we have advanced Google Closure compiler we mostly don't need it. Are there any gotchas when you actually want to use it?
@jumar I Just heared a defn about https://github.com/thheller/shadow-cljs and it has better support for it. For a pet project I have two builds, one for a visitor and one for an editor. I did it by having component-like structure, and call the units of the needed components in either the editor or visitor main.
@pontus.colliander I have a mixed Clojure and Clojurescript codebase, though
Mixed content should not be a problem for shadow-cljs loading the cljc/cljs sources should work the same.
I have everything setup nicely with lein so moving over to shadow-cljs makes me nervous
Would you suggest keeping lein for the former and moving to shadow-cljs for the latter?
One more question: does it play nicely with figwheel or do I have to totally move over to shadow-cljs?
looks like the latter...I'll try to make it play nicely but if it's an uphill battle i'll give up
@vheuken: if you mean (.AutoReplace js/SlateAutoReplace args...)
then I agree that is the more common form, but it is equivalent to ( js/SlateAutoReplace.AutoReplace args...)
. Neither works, where (.default js/SlateAutoReplace args...)
does. There's something I don't understand about how export default
is effecting the extern.
Incidentally, I recall a blog post specifically about loading ReactPlayer in Leiningen: http://blob.tomerweller.com/reagent-import-react-components-from-npm . Might be an alternative if you don't want to bring in shadow-clj.
It's inside a go
block
js-obj
, clj->js
works
I think that it's a issue with async/go
and # js
I’m trying to use a package from cljsjs
(to be more specific cljsjs/sortable
). I’ve added the package to my dependencies and I’m importing in my namespace as instructed but it immediately throws an error and the error is not that helpful unfortunately. is there anything else I need to add to my config?