This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-19
Channels
- # aatree (33)
- # admin-announcements (70)
- # alda (6)
- # aleph (2)
- # announcements (6)
- # aws (7)
- # beginners (40)
- # bitcoin (1)
- # boot (138)
- # cider (24)
- # cljs-dev (9)
- # cljsjs (18)
- # cljsrn (35)
- # clojars (4)
- # clojure (211)
- # clojure-art (4)
- # clojure-austria (2)
- # clojure-hamburg (8)
- # clojure-russia (66)
- # clojure-sg (3)
- # clojured (1)
- # clojurescript (73)
- # cursive (9)
- # datomic (124)
- # dirac (8)
- # editors (3)
- # emacs (13)
- # euroclojure (10)
- # hoplon (207)
- # jobs (4)
- # ldnclj (27)
- # lein-figwheel (3)
- # leiningen (10)
- # mount (5)
- # music (1)
- # off-topic (9)
- # om (92)
- # onyx (36)
- # perun (30)
- # proton (47)
- # re-frame (11)
- # reagent (11)
- # ring-swagger (7)
- # yada (2)
@micha: this is the response from the auth0 support in their slack channel:
i was just trying to get the auth0-lock cljsjs extern working with Hoplon
but I ended up needing to manually add the script from their CDN into the page using Hoplon
this happens before that
like have it wait for you to initialize it, rather than just stomping around in the dom?
no, it does not wait
not for this bit
so, it does have an "init" style thing that you do, by passing in the client ID for the app you're working on
because i'm sure there are a lot of ways just inserting random stuff into the dom whenever you want can interfere with things
but it also messes with the DOM before you init it, like as soon as the script is pulled into the page
i agree that it's not how I'd make a library, or a pattern that I've seen elsewhere for that matter
but who knows if there's some reason why they did it this way
they also suggested that I add the CSS straight from the CDN, as an option
although probably downloading it from the cdn and just pasting it in the page would be good
which is fine, but... I don't trust everyone in the chain of development to keep the CSS version from the CDN and the CSS written by the script to the page 100% identical
it would be so easy to grab version 8.x.y of the CSS and 8.x.z of the script, with a bung git branch
and not notice until some weird bug crops up later
ummm, i can check pretty easily
one sec
not developer friendly at all
just vomits minified inline css into the page
yeah i could, but the day that someone changes the script by a minor version and forgets to update that CSS file
i'm opening myself up to issues
(function (global){
/**
* Insert css when first loaded
*/
require('./lib/insert-css');
yeah it's not like "put the script in your page, then tell it when to init, then use it"
it's like "the script will become your page, then you can ask it for permission to use it, then maybe you can use it"
yeah, i'll be maintaining it
but i'm cool to refactor things, as long as the refactor isn't wading through a bunch of "being setup to fail" type situations
oh, i didn't know you could do that with Hoplon
is that new?
because I saw a thread in the forums about it, but whenever that thread was around it was apparently hard or not fully supported
ah cool
i don't think i have to go that far though
pragmatically, it appears that auth0 just messes with the head and adds an overlay in the body of the page
that might change in the future, because it could do basically anything to the page, in theory
but for now i think it's just CSS and an overlay
yeah i mean if this application will be around for a while it's worth the investment to refactor
but really, i already have a defelem
for "outermost html"
refactoring that to be like what you describe would be easy
at any point
just knowing that I have that option is great
yeah, but i like building head
and body
in hoplon
although (html-meta
caught me out
i was expecting it to just be (meta
yeah, well it makes sense once you know
but when you're in the headspace of "trying to make an html element" you're not necessarily thinking "what core thingos am I conflicting with right now"
although, it's obvious really
meta could have gone either way, especially since it's more common to use it in html than it is to use it in cljs
nah, consistency is better
the way it is now is right
i like what it's doing
i think it's a human problem
not a code problem
what about meta-tag
honestly, the... obviousness... of cljs and hoplon is what is attracting me and encouraging me to keep going
i was annoyed that I had to work through a broken link, then a wiki that mentioned nothing about it, then finally read through the autogenerated API docs
to find html-meta
but once i knew about it, i liked that it was "no magic"
from the readme
i go through the same process every time
i never learn 😛
broken link, @todo
wiki, then finally this page https://crossclj.info/ns/hoplon/latest/hoplon.core.cljs.html
i should just bookmark it or something
where's the hoplon dev at atm?
like, what's the focus?
although i have been working for a while on fixing one of the problems with the hoplon model, but it's kind of a hard problem to solve
(defelem mylist
[{:keys [title] :as attr} kids]
(div
(h3 :text title)
(ul
(map li kids))))
because the div you append to list1
doesn't get wrapped in a li
and appended to the internal ul
in there
why doesn't it work?
so the things you pass directly as arguments of the mylist
function are handled correctly
yeah, i think it's too late for me to be thinking about this
it's like 2am here
it seems you can't really solve this without carrying the original defelem function around
yeah instead of actually appending the element, it would append the element to a ajvelin cell
back to a question I asked a few days ago. If I have (script :type “text/javascript” :src “js/d3.min.js”)
in my (head … )
. How do I refer to d3
in ClojureScript? I’ve tried to use (-> js/d3 …)
and that works sometimes but not other times. It seems that if I simply save my changes, it works but when I’m all done, if I reload the page, it fails. It complains that it can’t find d3
.
that should work, provided that the js file defines a top level thing in the global object named d3
one of your cljs namespaces could be using it before the script has been inserted into the head
@actsasgeek: first question: are you sure you need to include d3 as a script tag in the head?
and it appears that there is one: https://github.com/cljsjs/packages/tree/master/d3
yes but that doesn’t teach me anything
hmm, ok.
so [cljsjs/d3 "3.5.7-1"]
would go in build.boot
:dependencies?
there is a bunch of documentation here: https://github.com/cljsjs/packages
(ns my.name.space
(:require [cljsjs.showdown]) ; note, no :as or :refer here
(defn convert-to-html [markdown]
;; note the syntax below: js/VarFromExternsFile.property
;; the dot on the end is the usual Clojure interop syntax:
;; (Constructor. constructor-arg constructor-arg)
(let [converter (js/Showdown.converter.)]
;; methods you call will generally need to be called out as prototype
;; values in the externs
(.makeHtml converter markdown)))
yeah, that makes sense. When I asked the other day, Alan said if he were doing the Dashboard example over again (without hoplon’s old style automatic importing), he’d just use a (script …)
tag so that’s why I started there. The problem, of course, is that when you’re new to everything (ClojureScript, Hoplon, etc.) when there’s a problem, you simply don’t know where the problem is coming from.