Fork me on GitHub

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?


Because Object.keys(deviceOrientationEvent) is just ['isTrusted'].


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'])


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:


are there any monadic async libs for Clojure(Script)?