This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-29
Channels
- # aws (1)
- # aws-lambda (2)
- # bangalore-clj (3)
- # beginners (26)
- # boot (25)
- # braveandtrue (1)
- # cider (5)
- # cljsrn (7)
- # clojure (144)
- # clojure-android (2)
- # clojure-czech (1)
- # clojure-greece (3)
- # clojure-italy (17)
- # clojure-poland (5)
- # clojure-russia (25)
- # clojure-spec (9)
- # clojure-uk (100)
- # clojurescript (85)
- # core-async (42)
- # cursive (11)
- # datascript (2)
- # datomic (25)
- # duct (3)
- # emacs (5)
- # figwheel (2)
- # fulcro (49)
- # graphql (16)
- # hoplon (8)
- # klipse (10)
- # leiningen (10)
- # lumo (9)
- # off-topic (12)
- # om (14)
- # onyx (25)
- # planck (34)
- # portkey (6)
- # re-frame (43)
- # reagent (4)
- # remote-jobs (2)
- # ring (36)
- # ring-swagger (1)
- # rum (1)
- # shadow-cljs (187)
- # specter (25)
- # sql (5)
- # unrepl (75)
are https://github.com/jeluard/hipo/ and https://github.com/plumatic/dommy still actively maintained ?
I don't want the full power of react/reagent; I just want to, on client side, take a piece of hiccup, and render it into a HTML DOM Node. I can't do hiccup -> html -> document.write because this hiccu7 contains :onClick handlers and attached cljs functions
@qqq I was pretty disappointed with dommy and hipo, but used them as inspiration to write some util functions using the Google closure library. For example I have a function that takes hiccup syntax and create a node. Depending on the other parameters it's put somewhere in the Dom. For example you can replace an existing Id, of append to one.
@qqq there are even some closure utils in clojurescript core itself, but even those are out of date. If more people are looking for something like that, e.g. easy Dom manipulating, and adding some basic listeners. I might open source that part.
@gklijs: I have this weird use case, where I have this entity-[attribute, value] store, where each entity has a corresponding SVG node / subtree. Then, whenever, I update an attribute of some entity, I need to modify the corresponding SVG node. I thought this would be fast in reagent, but it's slower than I thought, so I'm now trying to see if I can direcly mdify the DOM somehow.
Yes, it's basically the only way clojurescript is used it seems. I like working with websockets. And while I could update the state and wait for Reagent to render the page, it seems to make a lot more sense to directly change the Dom
https://github.com/ibdknox/crate <-- yet another library I want to use for direct manip, also gone
@shaun-mahood enfocus uses domina for dom manipulation, which seems abandoned. Also it uses a different way to template.
There is also https://github.com/Respo/respo which might turn out to be really nice
however, what is the benefit of having a virtual dom layer of indirection between cljs and the actual-dom ?
is the performance gains solely from all the updates being batched into the requestAnimationFrame ?
I guess that helps, I’m far from an expert on javascript, but I do know a large part of the success of react is the virtual dom. It’s probably (but now I’m really speculating) also a good way to fix differences in browsers, since you have a kind of ‘middleware’ to solve those.
apparently there is a way to change: https://github.com/Respo/respo/wiki/dom-properties
@jiyinyiyong: are you the author of Respo? (lots of the github wikipages I'm reading are last edited by you); can you comment on whether respo allows me to say "change object ID 's attribute ATTR to value V" directly on teh virtual dom ?
you can change the tree with any means available in Clojure. but I think it's unlike attribute manipulation in JavaScript.
in Virtual DOM, you pass in a new map of props, its real props are changed by diff/patching inside a framework.
@leonoel: nothing, but 1. if I use reagent/om, I have to worry about refreshing 2. if I don't use reagent/om, I need to do my own event handling + efficient way to create lots of nodes (requestAnimationFrame?)
reactive event handling is a problem of its own and it's kind of sad that all tools we have in clojurescript couple it with dom handling
@leonoel: "reactive event handling is a problem of its own" <-- what does this mean ? // I thought the point was to have react abstract away all the browser incompabilities // what problems does it introduce ?
by reactive event handling I mean having a declarative way to compose event streams. this problem is totally unrelated to browser incompabilities and both should be solved separately imo
err, sorry, I meant https://github.com/reagent-project/reagent/blob/master/src/reagent/core.cljs#L211 from reagent
(defn foobar []
(let [builder (Builder.)
sanitizer (.build builder)
ss (.sanitize sanitizer "<div>Hi<svg width=100 height=200><rect></rect></svg></div>")
_ (. js/console log "ss: " ss)
x (gdom/safeHtmlToNode ss)
app-dom (gdom/getElement "app")]
(. js/console log "app-dom: " app-dom)
(.appendChild app-dom x)
(. js/console log (str "x: " x))))
it appears goog sanitizer is killing my svg@leonoel A colleague of mine helped open sourcing this https://github.com/politie/sherlock to help with reactive environments, not sure how usefull it is with clojurescript, as I would guess all the problems it solves are solved by re-frame as well.
Hi, I am currently working on a reagent program, the js file compiled using advanced
mode get an error but the error is not found in the none
mode compiled js file.
Uncaught TypeError: k is not a function
function ka(a) {
return "function" == k(a)
}
What could this problem be?most likely it's an interop problem, you're using a js library or calling js interop. For the former you need to provide externs file to let the compiler know which names not too touch.
also watch out for: http://squirrel.pl/blog/2013/03/28/two-ways-to-access-properties-in-clojurescript/
@cmal run shadow-cljs check <your-build-id>
. it should complain about undefined properties.
@thheller @fbielejec thanks.
I see that this https://dev.clojure.org/jira/browse/CLJS-308 was implemented, but I can't get the type hints to work.
I have (defprotocol Ctx ...)
, and (defn x [^Ctx ctx] ...)
below it. But it results in Unable to resolve classname: Ctx
is there any virtual dom that makes a "transactional behaviour "gurantee -- that either all the dom updates happen, or none of the dom updates happen -- but it'll complete 'only halfway'
the construction of the virtual dom elements is usually what fails, once that succeeds and the diff succeeds there should be very little else that fails.
I don't know; I am trying to write my own diffing layer, realized things would be in an inconsistent state if only half the updates went through, then started wondering if virtual-dom could provide a solution
Hi I have a quick question. I have a multimethod that works fine in clojure,but blows up in clojurescript
(defmulti get-default-def identity)
(defmethod get-default-def :text
[val]
{:field/id 1
:field/name :newfield
:field/label "New Field"
:field/type :text
}
)
(defmethod get-default-def :longtext
[val]
{:something :else})
...
Running say (get-default-def :text)
in clojurescript is causing an exception : #object[Error Error: Invalid arity: 0]
Any idea what might be causing this?@eoliphant can't reproduce, works just fine. Try to restart your repl - maybe you've redefined your multimethod and stuff got mixed up somehow
yeah it’s really weird, I have multimethods working fine elsewhere, restarting everything to see what happens
it blew up in my code in the webpage first, and still did after I tried it in the figwheel repl
@eoliphant FYI defmulti is like defonce, if the multi already exists it’s a no-op, so you need to delete the multimethod to make a new definition
this is done intentionally because if re-evaluating defmulti created a new multimethod, it would break all the defmethod calls in the rest of your codebase
so you need to delete the var (or def to nil) to make defmulti actually do something