Fork me on GitHub

Any recommendations for how to approach WebGL stuff with cljs? I've seen a couple examples using Three js via cljs->js interop. Is there a cleaner way to do it?


I would recommend looking into react-three-fiber, It is doable, I ported a couple of their demos under cljs here:


I’m struggling using a JS library in context of a react-native app using shadow-cljs. The library is I can call into the library from pure JavaScript but translating these calls to ClojureScript does not work. Probably I’m missing something. Never had any trouble with using JS libraries from CLJS in this context. What makes the library different is that it exports a JS class and I suppose there is a difference regarding this when I call into the library?

🙌 1

The library:

export default class Auth0 {

   * Creates an instance of Auth0.
   * @param {Object} options your Auth0 application information
   * @param {String} options.domain your Auth0 domain
   * @param {String} options.clientId your Auth0 application client identifier
   * @memberof Auth0
  constructor(options = {}) {
    const { domain, clientId, ...extras } = options;
    this.auth = new Auth({baseUrl: domain, clientId, ...extras});
    this.webAuth = new WebAuth(this.auth);
    this.options = options;
and this is the call in JS:
import Auth0 from 'react-native-auth0';
const credentials = require('./auth0-configuration');
const auth0 = new Auth0(credentials);
let webAuth = auth0.webAuth;
console.log('webAuth: ' + webAuth);
webAuth.authorize({scope: 'openid profile email'})
       .then(someCredentials => {...})
My attempt to call the same authorize function/method in CLJS:
(ns auth0.core
  (:require ["react-native-auth0" :as Auth0]))

(defn create [config]
  (new Auth0/default (clj->js config)))
    [auth0.core :as auth0]))
(def config {:clientId "...."
             :domain ""})

(def auth0 (auth0/create config))
(def webAuth (.-webAuth auth0))
(def authorize (.-authorize webAuth))
(authorize #js {:scope "openid"})
This fails with:
ERROR: TypeError: undefined is not an object (evaluating 'agent.newTransaction')
where agent is undefined.


:as Auth0 is incorrect in this case


oh wait nvm you are using /default


just call the authorize maybe? (.authorize webAuth #js {:scope ...})


To be honest, I was poking around in the repl and was wondering why there is default but it returned some structure that appeared to be useful 🙈


don't get the property of an object if you are supposed to just call ist


webAuth.authorize({scope:...}) translates to (.authorize webAuth #js {:scope ...})


the .- would be let authorize = webAuth.authorize; authorize(...) and that likely won't work either


I’m pretty sure I tried that at first hand… but obviously not since it seems to work now.


Thank you very much @U05224H0W.


I guess I have to reread the whole docs on using NPM.


js interop can be a bit tricky at times but gets easier when you have done it a bunch 😛


Anyone familiar with this issue?


project still compiles and runs.


I find when that happens, do a rm -r .shadow-cljs (the directory that starts with a . NOT shadow-cljs.edn)


Something gets out of sync like new deps or node packages it seems.


which shadow-cljs version do you use? this issue should have been fixed a while ago?


Where am I missing a :key ? Warning: Every element in a seq should have a unique :key:


The fix was that

(defn premium-block-blur [& children]
Should be without & . Must have something to do with the fact that there are no other props. The error is quite misleading though. Hope this helps someone else stumbling upon the same issue 🙂

🙌 1
gratitude-thank-you 1

except for the element in the for none of those should have a :key

JB Seo00:11:45

[:div {:key "children"} children] -> (-> [:div] (into children) . This behavior is little difference from those of React.

JB Seo00:11:36

For react, special prop children is not plain array, but a react component. For cljs, & children is just a sequence. That's why its elements should be 'key'ed or should be turn into vector.


I am just tinkering with Krell. Can’t find right key for React renderItem. Any help appreciated, thanks.