Fork me on GitHub
#clojurescript
<
2016-11-30
>
Aron00:11:00

so, it's interesting how writing (js/document.body.appendChild domEl) works I thought I will have to write this differently

bbloom01:11:22

turns out that data access for objects designed for a C-style syntax language are useful to have infix operations for 😉

bbloom01:11:03

you can use (.. js/document -body (appendChild domEl)) if it makes you feel more lispy (i think that syntax is right)

Aron02:11:25

what is the -

bbloom02:11:06

property access instead of method call

bbloom02:11:25

to differentiate (.-methodCall obj) from (.-field obj)

bbloom02:11:31

ie obj.methodCall() vs obj.field

bbloom02:11:36

note the parens

Aron02:11:35

i am confused. what's the difference between (.-methodCall obj) and (.-field obj) ?

Aron02:11:01

other than that, i think i understand

mikeb06:11:36

I'm wondering, has anyone ever given any though to building clojurescript tooling that works with or uses native js tools like yarn/gulp rather than lein? How about publishing cljs libraries to npm?

thheller11:11:20

@mikeb npm is somewhat at odds with what cljs/closure want to do .. so publishing cljs libaries on npm is a bad idea

Aron11:11:15

yeah, it's only possible if you decide ahead what you want to use, compile everything together and put it up

Aron11:11:38

because for example when i wanted to use datascript and mori from javascript, i needed this: https://github.com/typeetfunc/datascript-mori/

thheller12:11:56

yeah exactly everything from the CLJS side should be bundled together and compiled separately

thheller12:11:12

otherwise they each bring their own cljs.core which will only cause problems

Aron12:11:57

and the shortened names of methods and properties will not match up

thheller12:11:45

I have feature in shadow-build that lets you create a node/UMD module easily

thheller12:11:40

basically you just define a map {:thing cljs.core/assoc} and the output lib.js

thheller12:11:08

you can then var x = require('./lib'); x.thing(); via node

thheller12:11:02

so the cljs things live happily in the cljs world without getting to close to the node world

thheller12:11:34

not ideal but it works well enough I guess

Aron12:11:50

but then 2 different modules would use different cljs.core as you said before?

thheller12:11:20

well yes you can still only have one of those

thheller12:11:39

basically it just automates what datascript-mori does

Aron12:11:03

i am confused, those two seem to be conflicting

thheller12:11:26

a basically empty namespace

thheller12:11:34

with just a bunch of ^:export

thheller12:11:40

instead of writing tat

thheller12:11:02

(def ^:export schema_to_clj djs/schema->clj)

thheller12:11:35

{:schema_to_clj datascript.js/schema->clj}

thheller12:11:48

inside the build config

thheller12:11:56

that is it really

Aron12:11:03

it's longer

Aron12:11:06

😄

Aron12:11:39

anyway, i think i get it now

Aron12:11:53

thanks for explaining

thheller12:11:24

well not really

Aron12:11:07

i was joking, hence the smiley

peeja15:11:43

Is it possible to get the docstring of the current namespace from CLJS (ie, not from a macro context)?

dnolen15:11:18

@peeja namespaces aren’t reified, so no

peeja15:11:35

Kinda what I figured, though

dnolen15:11:46

runtime metaprogramming stuff around nses & vars are not portable between Clojure/ClojureScript

dnolen15:11:03

and never will be - damages advanced compilation for the obvious reasons

peeja15:11:21

Yeah, I don't need it to be portable, just to get to it. I'd like to use the ns docstring in a devcard

peeja15:11:32

I can make a macro that just returns the docstring, though, right?

dnolen15:11:31

@peeja well in theory it should work - I haven’t seen requests for getting at this kind of ns info at runtime so it may be that information is missing - you should try it and report if it doesn’t work for some reason

peeja15:11:44

Awesome, will do

dnolen15:11:49

ideally you can do this through cljs.analyzer.api

peeja16:11:40

(-> &env :ns :doc) appears to be working for me.

peeja16:11:57

(I only ever need the current ns, at least so far)

dnolen16:11:05

@peeja yep that works too

phreed16:11:47

Hopefullly I get a documentation reference to answer my question. Given an existing Javascript nodejs framework... How would I create a plugin written in Clojurescript? Particularly the framework I care about is https://webgme.org/ but any highly opinionated framework, like http://nodeframework.com/index.html#full-stack, would face the same issues.

dnolen16:11:05

@phreed regular ClojureScript just isn’t well suited for creating JS plugins, bootstrapped ClojureScript on Node.js maybe - but that’s a community effort and still very new

phreed16:11:19

@dnolen thanks, I guess I will stick with Typescript for this project then.

fingertoe18:11:01

Anyone have a good Gist or other hints on doing http GET or POSTs from raw nodejs interop? I am trying to use AWS lambda, and it doesn’t support xmlhttpRequest, thus no cljs-http..

dnolen19:11:14

@fingertoe Node.js has standard libraries for that

dnolen19:11:29

(def http (js/require “http”)) and goto town