Fork me on GitHub
#clojurescript
<
2019-12-06
>
Mehdi H.12:12:01

Hi all, Has anyone ever been able to use cljsjs/delaunator? I have tried multiple combinations of (js/Delaunator.from. [[1 2] [2 3] [1 5] [2 4]]) with different point formats (including the one in the example (<https://github.com/mapbox/delaunator>), which is [[1, 2], [2, 3], [1, 5], [2, 4]]. It seems from is not to be called as prototype values as described here (<https://github.com/cljsjs/packages/wiki/Using-Packages>) because of how the externs are defined here (<https://github.com/cljsjs/packages/blob/master/delaunator/resources/cljsjs/delaunator/common/delaunator.ext.js>). The output is : #object[Error Error: No Delaunay triangulation exists for this input.], although the points are not aligned... What am I doing wrong? Thanks!!

Mehdi H.12:12:25

Using (js/Delaunator.from. or (js/Delaunator/from without '.' doesn't even change the error message...

p-himik12:12:34

Have you tried wrapping your arrays in clj->js?

Mehdi H.12:12:39

holy hell you're right...it works. Well I am not getting any error. Any idea how to access hashedges from there? Cause the externs contain functions but for instance I can't even find in the original index.js the _hashEdge one

p-himik12:12:20

As soon as I see the words "externs" or "cljsjs", I immediately go to shadow-cljs for the help. 🙂 And then I can actually start working instead of yak shaving.

p-himik12:12:38

So that's the only advice I can give - use NPM libraries as is and use shadow-cljs.

Mehdi H.12:12:14

haha ok I will have a look! Thanks a lot for the help!!

p-himik12:12:20

No problem.

Mehdi H.12:12:40

turned out halfedges are properties of the js object, so (.-halfedges Object) worked 🙂 thanks again!!

👍 1
victord12:12:44

Hi, Do clojure and clojurescript code are interchangeable? I mean, if i write a program in clojure (that only use the core language features), can i simply change the dependency on clojure by clojurscript an it will work?

mccraigmccraig12:12:59

roughly @U2KGTH1EG - there are often small differences to take account of

restenb14:12:42

figwheel channels are dead so guess I'll ask here too

restenb14:12:55

i recently updated an old project to figwheel 0.5.19, which seems to have caused it to break somehow. files aren't correctly reloaded in the browser, and i'm presented with Figwheel: error loading filemessage in the console

restenb14:12:32

i tried increasing :time-in-msoption on the server to eliminate a basic timing issue, this looks like a browser issue however

restenb15:12:04

when I make a change, every file that change touches seems to time out independently when attempting to reload in the browser

Mehdi H.15:12:22

Hi all, anyone knows how to get the value at index n of Uint32Array? I can't get the syntax right, and can't find any helpful function or property in here : https://cljdoc.org/d/clojure-interop/cljs-web-api/1.0.4/api/js.Uint32Array

Mehdi H.15:12:23

I tried (get-uint32 array index) but it doesn't work

Mehdi H.16:12:00

oh wow...thank you so much rakyi!!! how could I have found this out?

Mehdi H.16:12:04

I tried all sorts of get...but not this one

alexmiller16:12:50

seems like aget is not on cheatsheet https://cljs.info/cheatsheet/

rakyi16:12:26

yeah, it is only in Clojure Cheatsheet https://clojure.org/api/cheatsheet

Mehdi H.16:12:22

I'll remember to check both! Thanks again!!

Ben Hammond16:12:30

I am trying to use js/MaterialUIStyles.makeStyles with react/rum/citrus It seems to be absurdly fiddly because • https://material-ui.com/styles/api/#makestyles-styles-options-hook ONLY works as a React hook • rum/defc will ONLY give me a plain-function component (suitable for hooks) if I avoid any kind of mixin complexity Is there a known way to make this less awkward?

dpsutton18:12:24

would like a non-breaking space in a string. should be "\xa0" and this works in the javascript console. However, clojurescript is just a clojure program and "\xa0" and this is an unsupported escape character. A workaround is (char 160) but wondering if there was a more elegant solution?

bfabry18:12:48

not much more elegant lol

dpsutton18:12:19

seems to be an underscore

bfabry18:12:33

oh actually you can put it in a string

bfabry18:12:40

cljs.user=> "foo \u00a0 "
"foo   "

dpsutton18:12:33

awesome. thanks!