Fork me on GitHub
#clojurescript
<
2016-02-11
>
zentrope02:02:27

Does :target :nodejs just add #!/usr/bin/env node to the top of output files? Is that all it does?

richiardiandrea05:02:36

@zentrope it does a bunch of other things to init, you can check also in Lambda-x/replumb

richiardiandrea05:02:46

Ok let me fetch the link for you

zentrope05:02:35

@richiardiandrea: Adding that directive broke things for running in Electron, mainly the shebang line.

richiardiandrea05:02:14

@zentrope Are you targeting nodejs or electron? I am not familiar with the latter..

zentrope05:02:52

Well, it’s all new to me. I’m targeting Electron, in which you can access nodejs libraries.

zentrope05:02:32

Electron also has two contexts, main (for running native code, like, say, opening a TCP socket), and renderer (for basic web page stuff).

zentrope05:02:57

However, even in the rendered context, you can js/require node libraries.

zentrope05:02:44

The issue I’m having is that ‘<!’ in core.async eats 100% of the CPU in the renderer (but is no prob in the main process).

zentrope05:02:04

Only on Windows, it seems.

richiardiandrea05:02:54

Mmm...that a whole new story to debug, no idea...really

richiardiandrea05:02:53

I would try to exclude causes one buy one, maybe leaving just core.async to start off

richiardiandrea05:02:06

No nodejs requires

zentrope05:02:18

Right now, that part of the code (loaded by the Electron chrome browser) has a single require.

richiardiandrea05:02:00

Btw i am interested, is there a lein template or some tutorial for electron apps and ClojureScript?

zentrope05:02:15

Not really. I’m using lein npm. There’s some examples: https://github.com/martinklepsch/electron-and-clojurescript (boot), and https://github.com/Gonzih/cljs-electron (lein).

zentrope05:02:25

Neither of those sets :target :nodejs which makes me wonder what it does.

zentrope05:02:53

I couldn’t use core.async in the main process without (set! js/goog.global js/global) though.

zentrope05:02:54

I’m also using lein npm, which works suprisingly well, though I suspect using a node toolchain with a cljs plugin (gulp?) might fit better.

richiardiandrea05:02:16

BTW i might say something untrue here...are electron apps multi-threaded, core.async might have been thought for single-threaded browsers only...

zentrope06:02:14

Is there a reason ‘>!!’ isn’t in the CLJS version of core.async?

venantius06:02:41

because in a single-threaded program blocking take will never be fulfilled

venantius06:02:13

I think in general the idiom of not supporting either <!! or >!! makes sense

kauko06:02:37

Agree, they wouldn't really mean anything

zentrope06:02:19

Wow. It sure seems to me that core.async, or setTimeout, or something, is broken on whatever version of Chrome electron is using in Windows.

zentrope06:02:05

As long as I have data moving through the channel, the cpu starts to go down. When it’s just waiting, 100% CPU.

zentrope06:02:24

Same with (chan n xform ex-handler) version.

maio09:02:57

@zentrope: just curious, are you running that windows in virtual machine?

slotkenov09:02:44

Any idea where to look when I get: Uncaught Error: Undefined nameToPath for project.config in my browser console?

slotkenov10:02:11

oops, my bad. Put the files in the wrong place

iwankaramazow14:02:51

Is there a Clojurescript equivalent for Clojure's name (convert keywords into strings)?

iwankaramazow14:02:58

probably a bug in my code name won't run

dnolen14:02:27

@iwankaramazow: make sure you don’t have a local called name which is shadowing cljs.core/name

iwankaramazow14:02:34

refreshing the page did it 😬

mfikes14:02:48

Or, if you want the colon and the namespace, etc. (str :foo/abc) is an alternative to consider

iwankaramazow14:02:35

thanks for the input, but it's fixed now 😄

arohner16:02:02

has anyone gotten figwheel to work with optimus-less? I want figwheel to reload my .less files when they change

arohner16:02:34

ah, User Error. I needed to 1) tell optimus to export files 2) use :css-dirs in figwheel to watch the export dir

chrisoakman18:02:45

@zentrope @richiardiandrea - Cuttle was written using CLJS + electron (back when it was called "Atom Shell"), it's a little dated now, but might be a helpful reference: https://github.com/oakmac/cuttle

richiardiandrea18:02:52

@chrisoakman: pretty good example thanks!

echristopherson18:02:15

Oh wow. I love the electron/atom shell name correspondence

josh.freckleton19:02:41

what is a good lib for generating svg line graphs, just something simple for doing a static chart of price over time?

meow19:02:55

@josh.freckleton: check on #C0F0V8DT5 where this has been discussed

josh.freckleton19:02:37

@meow: ah, didn't know about #C0F0V8DT5, still getting acquainted here, thanks! I appreciate it simple_smile

puppybits19:02:56

Does anyone know if EDN can be a Transferable object with Web Workers? Or is core.async could support <!!/>!! in JS? https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Passing_data_by_transferring_ownership_(transferable_objects)

echristopherson19:02:03

I hope there's something out there called either datavism or datavistic\

csmith19:02:32

@puppybits: Interesting thought. So, JS only has one thread so you can’t get parallel

csmith19:02:59

Maybe check out servant to see what it does for workers in CLJS to see how it passes data in/out

puppybits19:02:43

web workers are a separate thread.

puppybits19:02:09

they have a very small scope of use. (no DOM access or image decompression)

puppybits19:02:15

it’s good for processing and network requests. The boot up time of a thread/web worker isn’t great but longer lived threads have been good at some tasks.

puppybits19:02:57

Thanks I’ll check out servant. That seems to be in the vane of what I’m looking for.

richiardiandrea20:02:47

I started to have my :advanced js files including goog.addDependencies

richiardiandrea20:02:02

very standard profile, aaargh

richiardiandrea20:02:00

just :optimizations :advanced and :output-to isn't it supposed to work?

dnolen20:02:28

@richiardiandrea: it’s not clear what you are asking?

dnolen20:02:50

including goog.addDependencies to advanced builds doesn’t sound like a good idea

richiardiandrea20:02:04

basically today I launched lein cljsbuild once min and my final artifact started including goog.addDependencies without having specified a output-dir at all...but I am I know it is difficult do debug so I will need to investigate what is wrong...

peeja22:02:23

What's the canonical way to pass a "devmode" flag into a ClojureScript build to turn development-only features on?

peeja22:02:37

A dev-only :main?

dnolen22:02:55

@peeja: Google Closure defines are one way

dnolen22:02:13

if you’re talking about runtime customization anyway

peeja22:02:20

Ah, yeah, that sounds perfect

peeja22:02:26

Is that a compiler option thing?

peeja22:02:37

Oh, there it is

dnolen22:02:49

pretty sure that one is on the Compiler Options wiki

peeja22:02:58

Yeah, that's perfect! Thanks!