This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-20
Channels
- # beginners (102)
- # boot (23)
- # cljs-dev (1)
- # clojure (52)
- # clojure-canada (7)
- # clojure-korea (2)
- # clojure-poland (1)
- # clojure-russia (35)
- # clojure-spec (39)
- # clojure-uk (5)
- # clojurescript (64)
- # cursive (11)
- # events (1)
- # hoplon (168)
- # lein-figwheel (2)
- # luminus (14)
- # off-topic (47)
- # om (3)
- # om-next (1)
- # onyx (31)
- # quil (4)
- # re-frame (21)
- # spacemacs (1)
- # sql (1)
- # untangled (3)
- # yada (4)
Are there any bindings for rendering TEXT in WebGL via CLJS that is better than "just use a texture" ? Signed Distance Function: https://www.youtube.com/watch?v=CGZRHJvJYIg , https://www.mapbox.com/blog/text-signed-distance-fields/ Vector Textures: https://news.ycombinator.com/item?id=10824064 Glyphy: https://github.com/behdad/glyphy but there appears to be no cljs bindings anywhere.
@cigitia you don't need class
for web components, Reflect
seems to be the go-to solution for webkit and chrome
also mentioned here recently: https://webkit.org/blog/7027/introducing-custom-elements/
can't comment on the class
support for cljs, just saying you don't actually need it most of the time
Hey, any idea where to start looking when Counterclockwise doesn't find any of your cljs dependencies anymore? clj still works, cljs used to work fine
Hi everybody, I just finished some tutorials for Om (Om Now) and I would like to know if there is a migration tutorial or even a tutorial for Om Next ?
Hi! I’m missing something probably very obvious about Javascript interop… I tried to RTFM, but I couldn’t find anything.
Trying to use the stripe API - the documented method call is
Stripe.piiData.createToken({
personal_id_number: $('.personal_id_number').val()
}, stripeResponseHandler);
My code looks like this:
(.createToken (.-piiData js/Stripe) {"personal_id_number" ssn }
(fn [status response]
(prn "STRIPE STATUS" status)
(prn "STRIPE RESPONSE" response)))
plus using gobj/get and set https://lambdaisland.com/episodes/clojurescript-interop
Will do. This is my first foray into interop, javascript or java, so haven’t needed ..
and similar.
@credulous just for inspiration, here is an example how I would write such interop code using core.async and cljs-oops: https://gist.github.com/darwin/64600b52a61f01bd2a6ab21de69aec47
instead of doing (.addEventListener js/window "keypress") is there a way to say: make this the ONLY keypress event handler on js/window ?
Is there a nice way to convert a "KeyboardEvent" (the event from pressing a key) do a cljs map ? I'm running (select-keys e [:altKey :ctrlKey :shiftKey :keyCode ...]) and getting {} in return I suspect this is because js / KeyboardEvent is NOT a cljs map.
@darwin: thanks for the tip! I like the aget solution. Got it working with: (into {} (map #(vector % (aget e (name %)) [list of keys we want]))
@hwk: more advanced solution would be to “teach” a particular javascript type a set of protocols which would allow it to act as cljs map or vector, you can get the idea from this code: https://github.com/binaryage/dirac/blob/master/src/shared/dirac/dom/shim.cljs
@darwin: so the idea would be: 1. KeyBoardEvent extens js/MapWhatever 2. (:key KeyBoardEvent) gets mapped to some function call in the MapWhatever protocol 3. We implment that function call on KeyboardEvent 4. Now, a KeybaordEvent, as far as CLJS is concerned satisfies the Map interface and we're good. ?
yes, that’s the idea, you can look into clojurescript sources how various associative structures are implemented in core.cljs
@darwin: this is very cool, and I need to learn it some day, but in all honesty, atm, I need to get this cljs svg editor ot work 🙂
@theller: that is insightful; even worse, aren't js events ephemeral? i.e. I'm not supposed to keep a reference to it after the handler exits ?
one silly question: for tis function, what names is better? keyboardEvent->map or keyboard-event->map ... or something else ?
@thheller js/HTMLCollection
is not an array, you have to use .item
to access its items I think
hmm maybe don't remember exactly ... element.childNodes
is one of each and I had fun time debugging why may vector looking thing behaved weirdly 😛
Hi! Dunno if this is the right place to ask… but I’m having issues with the Javascript emitted from the Closure optimizer. In particular, I have some functionality that access an external JS library (Stripe.js) like this:
(.. js/Stripe -piiData (createToken #js {"personal_id_number" ssn }
In the compiled javascript, though, the relevant bit looks like this:
var b=$q.h(a);return n(b)?Stripe.Pi.createToken({personal_id_number:b}
Note the Stripe.Pi rather than Stripe.piiData. Stripe.Pi is undefined at runtime, so I get an error.
@credulous advanced optimization needs some help from you, have you see this doc? https://github.com/clojure/clojurescript/wiki/Advanced-Compilation
your Stripe library is a “foreign library” in this context, because you included it externally and it is not part of your advanced build
Urk! Thank you @darwin… looks like I had put a direct load into my home template some time ago and forgotten… and added the cljsjs/stripe entry to project.clj
another option is to access foreign keys by string names[1], or better using cljs-oops[2] [1] https://github.com/clojure/clojurescript/wiki/Dependencies#using-string-names [2] https://github.com/binaryage/cljs-oops#side-stepping-the-whole-externs-mess