@borkdude found this maybe-bug with SCI via Clerk… I built custom JS with this namespace:
(ns mathbox.clerk-ui
(:require ["three" :as three]
[nextjournal.clerk.sci-env]
[sci.ctx-store]
[sci.core :as sci]))
(def three-ns
(-> (into {}
(map (fn [[k v]] [(symbol k) v]))
(.entries js/Object three))))
(sci.ctx-store/swap-ctx!
sci/merge-opts
{:namespaces {'three three-ns}})
then, in my clerk viewer, I can call constructors with the new keyword:
(js/console.log (new three/Color 0xff4136))
and I seebut if I do (three/Color. 0xff4136) instead I get
It may be better to use add-class! for JS things rather than imitating a Clojure namespace
See:
https://github.com/babashka/sci/blob/master/doc/async.md
but feel free to post a SCI issue, perhaps it can be solved, maybe not
I've got some christmas thing today, so I'll be back tonight
Were you using the newest SCI for this?
I think so, transitively via the latest Clerk
no rush!!
No rush, but please make an issue else I’ll forget :)
will do