Fork me on GitHub
#clojurescript
<
2016-12-08
>
michaellopez00:12:04

how come (.toString (domi/text (x/xpath g “//title”))) works but not (.toString (domi/text (x/xpath g “//script”)))?

michaellopez00:12:39

where domi is domina

michaellopez00:12:07

and x is domina.xpath

aengelberg02:12:29

What's the best way to benchmark some ClojureScript code?

aengelberg02:12:08

Is there something like Criterium but for cljs?

danielcompton02:12:30

There is a port of Criterium somewhere

anmonteiro03:12:22

@aengelberg there's also cljs.core/simple-benchmark for more simplistic use cases

chooie04:12:28

Doing some testing on the browser. Is there any way to pipe the output of (run-all-tests #”some-test-file-regex”) to the repl?

vinodg06:12:45

how to use react-select ?

hulunote12:12:50

How to add args to dateRangePicker for cljs ?

hulunote12:12:00

I use the [cljsjs/jquery-daterange-picker “0.0.8-0”]

hulunote12:12:44

I try add arguments (clj->js {…} ) to dateRangePicker function,but it’s not work , why ?

pesterhazy17:12:45

@stevechan try it without reagent first, then add the reagent/react magic

pesterhazy17:12:37

besiders why not use a datepicker intended for react? jquery plugins are likely to result in problems with react's dominance over the dom

dimovich17:12:23

hello fellow clojurians, have one question

dimovich17:12:35

tyring to use photoswipe cljsjs lib

dimovich17:12:29

how to convert to cljs this code:

dimovich17:12:35

var gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);

dimovich17:12:49

this is my current cljs code, but the browser keeps throwing an error

dnolen17:12:34

(js/PhotoSwipe. …)

dnolen17:12:39

note the .

dnolen17:12:56

it’s worth reading the beginning of this guide

dimovich17:12:40

yep, works fine now! thanks

dimovich18:12:48

another question if I may... Need sth like this (justified gallery thumbnails) http://miromannino.github.io/Justified-Gallery/

dimovich18:12:23

how could this be done without jquery, maybe with some clojurescript lib

dnolen19:12:59

you’ll have to look around, but if you’re doing something that specific, might want to just stick with that jQuery plugin

hulunote20:12:47

Thanks 😗

hulunote21:12:51

Uncaught TypeError: (intermediate value)(intermediate value)(...).vh is not a function

hulunote21:12:26

I run my cljs project in production, it’s will error.

dnolen21:12:49

@stevechan you need externs if you’re using 3rd party libraries that you didn’t get from CLJSJS (and even then you might since the externs might not be right)

hulunote21:12:15

I didn’t get from CLJSJS, because CLJSJS’s daterangepicker is old.

anmonteiro21:12:38

also consider submitting an updated version, I'm sure it would benefit everyone else using that package!

hulunote21:12:29

@dnolen , @anmonteiro I don’t konw how to write externs.js, my “src/externs/externs.js” is:

anmonteiro21:12:05

I linked the CLJSJS externs for the daterangepicker package above

hulunote21:12:04

if i write jQuery.prototype.dateRangePicker = function() {};

jr21:12:53

var jQuery = function(){};

hulunote22:12:01

thanks,I konwed , but i try failure , @anmonteiro

hulunote22:12:17

@jr , it’s not work .

hulunote22:12:33

If i write externs.js like above, the cljs will skip all daterangepicker setting to compile .

dnolen22:12:28

@stevechan it’s probably simpler to just use jQuery from CLJSJS then you don’t need all that

dnolen22:12:34

just the datepicker bits

hulunote22:12:23

I didn’t get from CLJSJS, because CLJSJS’s daterangepicker is old.

dnolen22:12:50

@stevechan jQuery is a separate thing

anmonteiro22:12:24

@stevechan you're using a jQuery plugin. We have been assuming you already have jQuery on the page. Is that not the case?

anmonteiro22:12:38

then you need to make sure you also have externs for jQuery

hulunote22:12:58

because our team other people using the jq , i using cljs

anmonteiro22:12:39

I'm afraid I don't understand what you mean

dnolen22:12:53

@stevechan oh so you’re loading onto a page that has jQuery on it?

anmonteiro22:12:01

what I'm saying is: if you want to compile ClojureScript with advanced optimizations, you need to provide externs for jQuery

dnolen22:12:20

@anmonteiro but if the page already has jQuery then he’ll just want the externs

anmonteiro22:12:41

yes, it's all I'm saying

hulunote22:12:00

@dnolen yes, the page already has jQuery , from other people

anmonteiro22:12:48

@stevechan which version of jQuery?

dnolen22:12:05

get the one you need

hulunote22:12:42

* jQuery JavaScript Library v1.11.1

anmonteiro22:12:26

picking the 1.9 externs from the link David pasted should work

hulunote22:12:47

It’s no work, and any jq page it’s not show 😬

anmonteiro22:12:46

@stevechan I suggest you compile with :pseudo-names true to track down the issue in a stacktrace that preserves the original names

hulunote22:12:39

but it’s not work for compile

hulunote22:12:33

Thanks @dnolen , @anmonteiro 👍 👍 👍