Fork me on GitHub
#shadow-cljs
<
2019-01-02
>
orestis13:01:47

Has anyone managed to get devcards 0.2.6 working with shadow-cljs? The supplied example in https://github.com/shadow-cljs/examples/blob/master/deps-edn-re-frame-and-devcards/src/sniff/devcards.cljs doesn’t work for 0.2.6

orestis13:01:17

Seems like devcards expects js/React to be present.

thheller14:01:05

@orestis try including cljsjs.react before devcards

thheller14:01:12

that sets up the global React

orestis14:01:40

Thanks, done that. It needs both React and ReactDOM. This got things working again, but I don’t see things updating visually (although I see the shadow HUD and the reloading of some files). I think I need to call something to re-render my reagent components, but I’m not sure what.

orestis14:01:51

(defn ^:export main
  []
  (js/console.log "starting devcards UI")
  (dc/start-devcard-ui!)
  (devcards.system/renderer @devcards.system/app-state))

orestis14:01:55

hacky workaround

thheller14:01:04

yeah dunno what devcards needs. maybe relying on something figwheel specific.

orestis15:01:42

It does do some weird stuff in there (setting up some core.async channel etc and listening for figwheel events etc). But the above snippet works. I also filed an issue about it.

heefoo17:01:54

I am trying to experiment with the ivi library but i got a "DEBUG is not defined" when i require it

heefoo17:01:47

ivi is a virtual dom framework : https://github.com/localvoid/ivi

thheller17:01:50

@heefoo it seems to expect a non existant DEBUG global in the sources

thheller17:01:52

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Empty object.
 */
exports.EMPTY_OBJECT = DEBUG ? Object.freeze({}) : {};
//# sourceMappingURL=empty_object.js.map

thheller17:01:17

node_modules\ivi-shared\dist\main\empty_object.js

thheller17:01:44

that is not valid. not sure how thats supposed to work

thheller17:01:24

ah thought so. it expects you to configure webpack to replace that I guess.

heefoo17:01:57

I havent work with webpack for ages

thheller17:01:09

yeah not a great library if it expects you to do that

thheller17:01:00

as a quickfix you can set <script>window.DEBUG = false;</script> in your HTML before including the other JS

heefoo17:01:38

Makes sence

heefoo17:01:17

Would it work if i were to define it inside a cljs namespace ?

heefoo17:01:56

like (goog.object/set js/window "DEBUG" false) ?

thheller17:01:13

sure but you need to do it before including the ivi stuff

👍 5
heefoo17:01:16

now that i think it would have to be done before the ns declaration

thheller17:01:32

(set! js/window.DEBUG false) should do it

heefoo17:01:21

indeed i think set! is intented for js vars

heefoo17:01:35

ok Thanks thheller