This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-14
Channels
- # aleph (1)
- # announcements (4)
- # babashka (12)
- # beginners (28)
- # bristol-clojurians (1)
- # calva (28)
- # cljs-dev (8)
- # cljsrn (1)
- # clojure (16)
- # clojure-europe (2)
- # clojure-uk (125)
- # clojurescript (6)
- # cursive (17)
- # datomic (2)
- # kaocha (7)
- # off-topic (6)
- # reagent (3)
- # shadow-cljs (25)
- # sql (6)
- # tree-sitter (1)
I have an event listener for deviceorientation. And when I get the DeviceOrientationEvent (.stringify js/JSON ev)
gives {"isTrusted":true}
, and yet, if I do (.-alpha ev)
I get the correct angle. Why is alpha not included in the JSON?
Hmm, yes, that's true also. But I don't understand why. Although I'm still learning js too. Is there any other way that I could get the alpha, beta and gamma too, other than getting them one by one (.-alpha ev)
etc?
As to why - that's because DeviceOrientationEvent
is not a plain JS object, it's an object with a constructor and a prototype.
As to how to do it - just pass a JS array of the fields that you want to get as the second argument to stringify
:
> JSON.stringify(e, ['isTrusted', 'absolute'])
"{"isTrusted":false,"absolute":false}"
Hi, I'm having trouble creating and deleting inputs reactively (i.e. by manipulating a state atom). The problem only arises if I also want to bind the content of these inputs to the same atom using reagent-forms… I've posted a minimal example and analysis on Stackoverflow… would be great if any of you could take a look: https://stackoverflow.com/questions/60677426/reactive-adding-removing-inputs-with-reagent-forms