Fork me on GitHub
#clojurescript
<
2017-11-20
>
Alan Douglass12:11:57

hi, I'm trying to make a reagent GUI for editing a particular xml file. I've tried clojure.data.xml and tubax for parsing/writing xml but I'm having trouble either way - has anyone worked on reading/writing xml to edn in clojurescript?

Alan Douglass12:11:16

tubax only does the parsing, but I want to write too clojure.data.xml only has experimental clojurescript support, and gives the following cryptic error for a string "\n ": #object[Error Error: No protocol method IPrintWithWriter.-pr-writer defined for type string:

p-himik13:11:51

@ajdouglass I used it only for very rudimentary functions, so I can't really advise it, but maybe it'll help you: https://google.github.io/closure-library/api/goog.dom.xml.html

Alan Douglass13:11:33

thanks! I'll check it out

olivermooney15:11:54

is there an idiomatic way to translate the js ... operator into clojurescript code? I’m using a react library that hands the lib consumer a set of props containing arbitrary key-value pairs, and their samples show them being consumed via ...propset

Roman Liutikov15:11:23

@olivermooney if you are referring to a JS object of React props that is being spreaded onto React component with JS’s spread operator, then just pass props as an object into that component

Roman Liutikov15:11:46

(js/React.createElement "div" propsset)

Roman Liutikov15:11:40

if you also want to merge existing props object with the one provided by a library use js/Object.assign

Roman Liutikov15:11:55

or goog.object/extend

olivermooney15:11:08

@roman01la perfect thanks! - I am merging it with my own set first and was getting tied up between merging js & cljs maps

Roman Liutikov15:11:38

@olivermooney in that case you have to have both objects in same format (JS or cljs)

olivermooney15:11:27

@roman01la yeah I’m using #js on a shallow cljs map and I’ll use Object.assign to combine the two

Roman Liutikov15:11:49

nice! that should work 🙂

olivermooney15:11:39

@roman01la sweet success, cheers!

mhcat16:11:33

hey, does anyone have a recommendation for a sql migrations tool targeting clojurescript that works with node and mysql?

pesterhazy17:11:47

why does it have to be written in those languages?

pesterhazy17:11:11

I'd just use whatever you're familiar with - flywheel or something written in python or whatever

pesterhazy17:11:23

(sorry if that's not a helpful answer)

risto17:11:33

has anyone used figwheel with lumo?

mccraigmccraig17:11:30

there's juxt/joplin @j0ni - but that's clj only - i don't know of anything for cljs

mhcat17:11:19

thanks @pesterhazy @mccraigmccraig I hadn't considered that it doesn't need to be in cljs, that's a good point

mhcat17:11:32

I may just end up using ragtime afterall 🙂

vemv18:11:10

anyone familar with clojure macros being flakey?

vemv18:11:33

100% sure I'm defining them correctly, I've done cljs for a while

vemv18:11:00

it's more of an issue of {cider, cljs, figwheel} having poor error handling in some specific point

vemv18:11:38

^ that's what I see 1 in 10 times, with no other solution than restarting the whole jvm process

ajs18:11:45

Post the macro

hkjels18:11:09

@vemv I’ve seen alot more of these lately myself and have the same solution

vemv18:11:28

(proprietary source sorry)

hkjels18:11:37

@vemv I think it’s some relationship between cider and figwheel that’s not quite as sturdy as it used to be

hkjels18:11:56

or do you get these if you launch figwheel from a terminal as well?

vemv18:11:00

I think I exclusively get these when launching from emacs, good call

vemv18:11:06

I could science it later

hkjels18:11:20

Yeah, I haven’t had the time to dig in yet myself. Don’t even know what to put in an issue yet

grzm19:11:53

Under nodejs and :advanced compilation, I'm getting an error like #object[TypeError TypeError: wt.Fe is not a function]. It's not happening under :simple or :none compilation. I suspect it's because of references to nodejs modules being compiled away (I'm using fs.readFile). I have an externs file. What are ways to determine if the externs file is getting picked up during the compilation? I've purposefully misspelled it to see if that would cause an error, and sadly, I don't see one.

grzm19:11:59

I can confirm that readFile does not appear in the compiled file, so I'm pretty sure that's what's causing the issue.

vemv19:11:58

> What are ways to determine if the externs file is getting picked up during the compilation? @grzm in a given externs file, copy all the contents and paste them at the bottom then compile with the most verbose logging level. you should see a SEVERE goog error about the extern duplication

mfikes19:11:42

@grzm Try :pseudo-names; it will still fail, but with a human-readable name that should facilitate zeroing in on the problematic symbol. https://clojurescript.org/reference/compiler-options#pseudo-names

grzm19:11:06

@vemv Thanks. No failure there.

vemv19:11:59

just in case, this is the kind of verbose output I had in mind:

vemv19:11:18

(note the WARNING in the middle)

mfikes19:11:32

If you are right in that it is indeed fs.readFile, then yes, it will be down to figuring out why your extern is not being honored.

grzm19:11:05

@mfikes Yeah, I already have :psuedo-names and :pretty-print set to true. At least running it through cljs.test, I'm not seeing that error. Let me try with just a normal *main-cli-fn*

mfikes19:11:22

@vemv By the way, if you are using a Clojure 1.9 beta, you can use ClojureScript 1.9.946 in order to avoid issues with NaN (the bottom of your secreenshot)

vemv19:11:50

@mfikes I know! but I'm scared of that update because in order to make it work, I had to npm install a couple packages (otherwise I'd get certain stacktraces)

vemv19:11:05

babylon and something else

grzm19:11:56

Ah. misspelled pseudo. Yup. It's fs.readFile. Now to figure out my externs.

grzm19:11:49

When I compiled using lein cljsbuild, the misspelling was reported. Running through lein doo did not 😕

grzm20:11:22

And it was a misspelling in my externs file 😕 Looks like I need a spell checker.

grzm20:11:55

Thanks @mfikes and @vemv for the suggestions that pushed me in the right direction.

tomaas20:11:49

hi, https://developers.google.com/speed/pagespeed/insights/ testing a re-frame o reagent project build here, I've noticed that an Eliminate render-blocking JavaScript issue causes to loose many points. However if I try to fetch app.js file using async option in the script tag it complains because of document.writes in app.js. Is there some good way to achieve this?

thheller21:11:32

@tomaas don’t benchmark any :optmizations :none build. always try to use :optimizations :advanced before testing, those won’t have this problem.

tomaas21:11:29

I do look at the build with :optimizations :advanced

tomaas21:11:40

it seems that the only way to render js in server side

thheller21:11:26

hmm :advanced builds don’t usually document.write?

tomaas21:11:01

re-frame template, and it does have document.write

thheller21:11:49

must be some library code thats doing that

sova-soars-the-sora21:11:35

Is there a way to catch swipe gestures in CLJS?

dnolen21:11:48

@sova whatever you would do in JS will work (browser gesture APIs etc.)

sova-soars-the-sora23:11:53

@dnolen ah, thank you. I've not tried to catch swipe gestures in js til now. :study time: