Fork me on GitHub
#clojurescript
<
2016-07-18
>
ajchemist01:07:13

@dnolen @mfikes I think I got it, the node is not a child

ajchemist01:07:12

(def x x)
will make that exception.

mfikes01:07:13

@ajchemist: a minimal repro?

ajchemist01:07:01

yeah, obviously that is my typo mistake! but the execption message is quite horror

ajchemist01:07:40

what the hell 馃榿

mfikes01:07:57

Interestingly, the JavaScript associated with that is simply some.ns.x = some.ns.x. Hmm.

ajchemist01:07:20

anyway I鈥檓 happy to regain my :advanced optimizations!

mfikes01:07:08

@ajchemist: Cool, so while (def x x) is legit in ClojureScript, the fact that it causes an upstream failure with Closure under :advanced is now captured here https://github.com/google/closure-compiler/issues/1899

Ertugrul Cetin11:07:02

Hi guys, https://clojure.news is out! HackerNews clone written entirely in Clojure & ClojureScript

vikeri12:07:18

Can I prepend the :output-to-file with a custom js-file? I know :preamble exists but I would like something that only prepends to the initial file.

martinklepsch12:07:44

@vikeri: what's the "initial file"?

vikeri12:07:16

The output js file, the one that bootstraps the application, loads cljs, goog bootstrap and ultimately my main ns.

vikeri12:07:21

More specifically I want to add a bootstrap script that mocks out some stuff before running tests for React Native. I can accomplish this by running nodemon on this bootstrap file, but it would be neat to use doo directly without nodemon.

akiel14:07:48

is there something like timeago for cljs?

martinklepsch15:07:53

@akiel: You can use goog.i18n.DateTimeFormat and a component that updates in given intervals

akiel15:07:23

@martinklepsch: I use cljs-time now which also has intervals. but it was a bit of work and I have no localization

martinklepsch15:07:03

The intervals were more about triggering re-renders

akiel15:07:26

ah I see - I don鈥檛 even have re-rendering

martinklepsch15:07:14

ah ok, so you only want the relative time stuff not the auto-updating (I looked up timeago.js and I thought that's what you wanted 馃檪 )

akiel15:07:56

now as you said it, I also want auto-updating 馃檪 and everyting in om.next please 馃檪

martinklepsch15:07:23

Actually goog.i18n.DateTimeFormat doesn't help but goog.date.relative does: https://github.com/google/closure-library/blob/master/closure/goog/date/relative.js#L25

akiel15:07:13

hmm slack has a problem uploading snippets - so I can鈥檛 show what I currently have

akiel15:07:43

but the calculation of the intervals like 5 minutes is easy with cljs-time

akiel15:07:21

so now I only need to figure out how to trigger a re-render in om.next

juhoteperi17:07:38

@bhauman: I'm testing Figwheel repl with Vim-fireplace. Should it support redirecting println output from browser to editor/nrepl?

bhauman17:07:15

@juhoteperi: if you are using the latest, then yes, but this is dependent on your apps use of println

juhoteperi17:07:14

Is 0.5.4-7 recent enough? I'm mostly concerned about Fireplace's use of cljs.repl/source which calls println.

bhauman17:07:52

hmmm haven't tried that

bhauman17:07:54

works for me!!!

bhauman17:07:05

so helpful

juhoteperi17:07:31

Could something in the app break the redirection?

bhauman17:07:45

just try a standard println

bhauman17:07:54

(println 1)

juhoteperi17:07:00

Doesn't work either, it is only printed on the browser console

juhoteperi17:07:15

Works with boot-cljs-repl/weasel

bhauman17:07:25

yeah so I would back out the layers until you find the one

bhauman17:07:08

vim-fireplace sounds like the new party

bhauman17:07:20

but try from lein nrepl

bhauman17:07:31

using piggieback of course

juhoteperi17:07:52

Hmm, works from nrepl

juhoteperi18:07:06

@bhauman: Also about Fireplace, do you have opinion about providing cljs-repl-env function which could be used by Fireplace to connect to the repl? Fireplace calls piggieback/cljs-repl so current cljs-repl function doesn't work

johanatan18:07:25

can anyone explain how to use (i.e., require) a node module client-side in clojurescript?

johanatan18:07:38

e.g., a React component published on NPM

johanatan18:07:02

[my guess is that cljs.nodejs won't exist client side and thus nodejs/require won't either]

bhauman18:07:48

@juhoteperi: everything you need should be in the figwheel-sidecar.repl ns, if you need a refactoring, or if you want to make a fn available in the repl-api ns I'll take a PR

bhauman18:07:34

hmmm, darn thats going to take some thinking...

bhauman18:07:10

please make a PR so that I have a record of it

juhoteperi18:07:16

With some refactoring there wouldn't be need for this much duplication

bhauman18:07:26

thats what I mean

bhauman18:07:48

but there is a cost for missing something subtle here

juhoteperi18:07:21

Yeah I'm not sure if -repl-options work exactly the same as providing options to piggieback/cljs-repl

bhauman18:07:23

so maybe keeping it separate initialy is better

bhauman18:07:00

but I would still like the PR to be able to examine it

peterschwarz18:07:24

@johanatan: you're guess is right. You'll need to include the code in some way, built for the browser

anmonteiro18:07:32

@johanatan: normally I compile it with webpack as a UMD module and add it in the :foreign-libs compiler option

johanatan18:07:21

@anmonteiro: can you point me to an example on Github?

juhoteperi18:07:00

@bhauman: PR opened, I'll continue debugging the print redirection problem

johanatan18:07:06

@anmonteiro: so I used the re-frame template and it has a lot of stuff setup. I have no idea if it is using CLJSJS React or not (or if that is an important part of that setup).

johanatan18:07:16

scanning the 'project.clj' for 'react' and there are none

johanatan18:07:25

[i'm guessing that reagent itself pulls in react somehow]

anmonteiro18:07:54

@johanatan: I鈥檓 not sure what you鈥檙e asking now

johanatan18:07:14

is it important that CLJSJS React (rather than some other mechanism of obtaining React) be used?

johanatan18:07:43

[the thread you linked to seems to highlight CLJSJS React as crucial to that setup working]

johanatan18:07:10

[and if it is important, perhaps I do have CLJSJS React and don't know it (as re-frame/reagent are doing magic beyond what is in project.clj)]

anmonteiro18:07:41

@johanatan: not magic, but Reagent probably pulls React as a transitive dependency

juhoteperi18:07:49

@johanatan: You can check lein deps :tree to check what deps Reagent brings

johanatan18:07:37

ahh yep. looks like i do have cljsjs/react

anmonteiro18:07:53

re: thread, I don鈥檛 remember the specifics, all I know is it helped me set up a while ago

johanatan18:07:09

ok, cool. thx!

johanatan19:07:19

@anmonteiro: did you integrate the invocation of webpack from the lein build? or do it as a separate build step coordinated by a GNU makefile or similar ?

anmonteiro19:07:21

@johanatan: in the project I used it in, I did it only once and committed the generated module

johanatan19:07:12

so, looks like this is way overkill for my current purposes anyway as there is CLJSJS module for the component I want to use: https://clojars.org/cljsjs/fixed-data-table

johanatan19:07:19

Good to know for future reference though.

spelufo19:07:10

Hi, there is a problem with the quick start. The browser repl doesn't work with file urls, so just opening the index.html in the browser won't work, you have to serve the files for it to work, and the tutorial doesn't say so.

spelufo19:07:47

On the github clojurescript wiki. It says not to edit it, but to ask here instead 馃檪

krchia20:07:54

i鈥檓 having some trouble making a cljs version of this : http://bl.ocks.org/rkirsling/5001347#index.html

krchia20:07:42

my problem is mainly with the function tick(), it has an updated reference to path which is changed every now and then in restart()

krchia20:07:37

but when i鈥檓 using om, i can鈥檛 think of a way to make an equivalent tick() where i only initialize force once

krchia20:07:03

and tick always gets the updated reference to path/circle

krchia20:07:37

if i initialize it once in om/IDidMount, it will just tick once and stop

krchia20:07:20

i have to include this: (.on force-layout "tick" (on-tick app)) inside om/IDidUpdate, which makes me feel that i鈥檓 doing something wrong

anmonteiro21:07:49

wondering how to add a JSDoc annotation to a protocol function?

anmonteiro21:07:58

should I add it in the implementation or when defining the protocol?