Fork me on GitHub
#clojurescript
<
2018-11-25
>
sova-soars-the-sora13:11:27

Hi everyone. I would like to make a project using Rum and I want to use Datascript on the client side. Does anyone have any experience with thiS? What sort of connection scheme do you usually use between server and client when playing with tonsky/rum ?

rarous05:11:27

I would try to ask in #rum or #datascript, chances to get answer are higher.

dangercoder17:11:41

Guys do you know if it is possible to get access to a iframes source localStorage from the iframe parent page? (They are not of the same domain.) I've read that it is not possible. Done some testing but no luck so far.

Jonathan19:11:11

Hi folks, I’m getting errors when require-ing foreign libs in version 1.10.439 and it would be nice to know if this is a bug or an API change

Jonathan19:11:29

My project is set up according to https://clojurescript.org/guides/javascript-modules, but without leiningen

Jonathan19:11:04

So, there’s deps.edn, {:deps {org.clojure/clojurescript {:mvn/version "1.9.908"}}}

Jonathan19:11:41

watch.clj

(require '[cljs.build.api :as b])

(b/watch "src"
  {:output-to    "main.js"
   :output-dir   "out"
   :main         'hello-es6.core
   :target       :nodejs
   :foreign-libs [{:file "src"
                   :module-type :es6}] ;; or :commonjs / :amd
   :verbose      true})

Jonathan19:11:08

And the cljs and js files copied from those instructions

src/
├── hello_es6
│   └── core.cljs
└── js
    └── hello.js

Jonathan19:11:40

Then I can do clj ./watch.clj (with clojure 1.9) and it works great, node main.js prints the expected message

Jonathan19:11:49

now if I just change deps.edn to {:deps {org.clojure/clojurescript {:mvn/version "1.10.439"}}}, it breaks

Jonathan19:11:26

First there’s an error about clj-oss/module-deps, which, ok I wanted to use npm anyway so I install that

mfikes19:11:48

@johnnybrown7 It might be worth trying adding :npm-deps true to your compiler options. That changed with 1.10.439

Jonathan19:11:03

And then after a clean and a recompile, it fails with

$ node main.js
/Users/jb/src/hello-es6/out/hello_es6/core.js:28
return module$Users$jb$src$hello_es6$src$js$hello.sayHello();
                                                  ^

TypeError: module$Users$jb$src$hello_es6$src$js$hello.sayHello is not a function
    at Function.cljs$core$IFn$_invoke$arity$variadic (/Users/jb/src/hello-es6/out/hello_es6/core.js:28:51)
    at hello_es6$core$_main (/Users/jb/src/hello-es6/out/hello_es6/core.js:24:29)
    at Object.cljs$core$apply_to [as apply_to] (/Users/jb/src/hello-es6/out/cljs/core.js:12956:81)
    at Function.cljs$core$IFn$_invoke$arity$2 (/Users/jb/src/hello-es6/out/cljs/core.js:13400:18)
    at cljs$core$apply (/Users/jb/src/hello-es6/out/cljs/core.js:13358:24)
    at Object.<anonymous> (/Users/jb/src/hello-es6/out/AEF573C.js:10:17)
    at Module._compile (internal/modules/cjs/loader.js:722:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)

Jonathan19:11:25

The error persists after adding :npm-deps true

Jonathan19:11:33

(b/watch "src"
  {:output-to    "main.js"
   :output-dir   "out"
   :main         'hello-es6.core
   :target       :nodejs
   :npm-deps true
   :foreign-libs [{:file "src"
                   :module-type :es6}] ;; or :commonjs / :amd
   :verbose      true})

sova-soars-the-sora20:11:44

(.preventDefault e) and (.stopPropagation e) are not preventing page reload on submit press o.o

sova-soars-the-sora20:11:14

nevermind, changed button type to "button" (instead of "submit")

lilactown20:11:29

if you want to use a submit button type, you have to override the form action

sova-soars-the-sora21:11:31

override form action?

lilactown21:11:54

err, override the onSubmit

sova-soars-the-sora21:11:52

yes. was being very buggy ;/