Fork me on GitHub
#hoplon
<
2016-02-14
>
onetom04:02:37

@flyboarder: can you give an example where it caused a problem? i vaguely remember semantic-ui was actually trying to get rid of these situations... in our codebase i often see solutions where the classes were just merged at a string level because of this issue, but we haven't hit it recently i think. eg: (div :class (cell= (str "ui " size " button")))

jjttjj16:02:38

I can't seem to get amcharts working with hoplon. Starting with the hoplon template, if i simply add 4 script tags to the page like this:

(html
 (head
  ;; (script :src "")
  ;; (script :src "")
  ;; (script :src "")
  ;; (script :src "")

  (script :src "amcharts/amcharts.js")
  (script :src "amcharts/serial.js")
  (script :src "amcharts/themes/light.js")
  (script :src "amcharts/amstock.js")
  (link :href "app.css" :rel "stylesheet"))
 (body
  (h1 "Hello, Hoplon!")))
I'm getting an "AmCharts is not defined error in the js console, but I can access the AmCharts object at the js console. Any ideas what might be causing this?

dm316:02:33

where's the code that accesses amcharts?

jjttjj16:02:44

it's only in those other 3 scripts, which are also provided by amcharts

jjttjj16:02:44

all scripts are located in "assets" which is in ":asset-paths"

dm316:02:33

if you're sure you can access the object

dm316:02:38

I'd look more closely at the error

jjttjj16:02:40

hmm the errors are

light.js:1 Uncaught ReferenceError: AmCharts is not defined(anonymous function) @ light.js:1
serial.js:1 Uncaught TypeError: Cannot read property 'Class' of undefined(anonymous function) @ serial.js:1(anonymous function) @ serial.js:4
amstock.js:1 Uncaught TypeError: Cannot read property 'Class' of undefined(anonymous function) @ amstock.js:1(anonymous function) @ amstock.js:5
but i can go to each of the js files the errors occur in, and copy paste them to the js console without errors

jjttjj16:02:31

I'm on Windows (10) but having no other issues or errors running boot so I'm assuming this isn't the issue?

dm316:02:01

if you use URLs instead of asset paths, does it work?

jjttjj16:02:11

nope, exact same errors

dm316:02:44

then its unrelated to boot or hoplon

dm316:02:55

Id create a separate index.html

dm316:02:05

and debug what happens

jjttjj16:02:04

if i save the generated html and open the page I don't get these errors.... hmmm going to try prerendering

flyboarder18:02:19

@onetom: Here is an example (div :class ["ui "middle" "aligned" "center" "aligned" "grid”]) with the current implementation, the second aligned class is removed

onetom18:02:55

i see. now i remember a bit more. i've also did a similar hack back then...

onetom18:02:41

where is this middle aligned documented, btw? i was cmd-f-ing on the http://semantic-ui.com/collections/grid.html page but no word about middle

flyboarder18:02:24

@onetom: yeah I couldnt find it in the docks either, it centers along the layout axis

onetom18:02:19

yeah, i know, we also used it; im just surprised not seeing it in the docs, because it makes me wonder where have we learnt it from then? simple_smile

flyboarder19:02:22

It would seem the docs don't explain all possible grid format combinations, more reader exercises

raywillig20:02:39

@jjttjj: are you able to use (.getScript js/jQuery "script-name") wrapped in with-init! if so, it may be related to the timing of how hoplon blows away the dom and remakes it in it's image

jjttjj20:02:47

@raywillig: so that does work when i point to the local files, doesn't really work correctly when pointing to external files. thanks

raywillig20:02:10

hmm strange, i use that technique to bring google analytics into my hoplon app

jjttjj20:02:45

and even after the scripts successfully load I'm still getting an "Uncaught ReferenceError: AmCharts is not defined" when i do js/AmCharts in the same with-init! form

raywillig23:02:04

you probably don't want to do any amcharts initialization in the with-init! because it's loading script async

raywillig23:02:29

I think to that you can give a callback to getScript

raywillig23:02:51

you could do your amcharts initialization and then maybe set a cell so that you know it's been done