Fork me on GitHub
#hoplon
<
2015-08-16
>
micha14:08:07

@onetom: getting better at the testing process

micha14:08:34

also got a pretty good setup now with vim-ctrlspace workspaces etc

onetom15:08:15

happy to hear! i still owe u that uncle bob video though...

onetom15:08:25

im reading your latest commits. im also curious when did this on-page-load function appeared, since we were only using with-init! until now. last friday we tried to track down with my colleagues how the initialization is handled in hoplon5 but we got quite confused. we were expecting to find something like:

if (document.readyState != 'complete') {
	window.attachEvent ? window.attachEvent('onload', __ldinsp) : window.addEventListener('load', __ldinsp, false)
} else {
	__ldinsp();
}
but didn't quite get what's the bootstrap process. we tracked back until the init function, which i assume the hoploninit is calling somehow which is created by boot-hoplon...

onetom15:08:21

it's important for us because we would like to mix in a couple of 3rd party libs and they dont seem to work when we just add them as with-init! functions

micha16:08:07

@onetom: to see the bootstrap process you should look at the cljs namespace hoplon emits from the compiler

micha16:08:38

basically the expressions in your page are evaluated like a normal namespace

micha16:08:32

the with-init! macro just adds a jQuery(function() {...}) callback, to be executed after the document ready event is fired

micha16:08:04

so there isn't really a bootstrap process, as such

micha16:08:05

i guess the thing that might be confusing is the behavior of the html, head, and body functions

micha16:08:59

those are necessarily singletons, they exist when the page is loaded and simply mutate the existing document html, head, or body in place

micha16:08:06

they don't create new objects

micha16:08:56

most browsers get confused if you try to replace the html element, or the head or body

onetom16:08:46

ok, the hoplon6 add-initfn! is clearer indeed. i guess i shouldn't bother looking back at the past... just bite the bullet and make the hoplon6 version work finally.

micha16:08:40

i think add-initfn! is probably redundant in h6

onetom16:08:17

i didn't do direct jquery for years now, so i was not aware of the jQuery(function(){}) API. i got stuck at the $(document).ready() or something like that. http://api.jquery.com/jQuery/#jQuery3

micha16:08:40

there is an issue with fouc (flash of unstyled content) i will have to deal with soon

micha16:08:13

you can work around it with prerendering most of the time

onetom16:08:48

well, my content depends on the logged in user, so i can't really work around that

micha16:08:50

i'll be working on a fix in a week or two when my beta deadline comes due

onetom16:08:00

i didnt know that problem had a name simple_smile

onetom16:08:10

but it's affecting us more and more too

micha16:08:27

i haven't fully identified the issue yet

micha16:08:49

if you can get a good idea of what the problem is i can work on a fix

micha16:08:05

or in 1 or 2 weeks i'll dig in and get to the bottom of it

micha16:08:53

do you have any current blocking issues with your projects?

onetom16:08:15

just the prerendering failure with holpon6 but i havent got to isolating the issue yet

onetom16:08:23

the 2nd thing is this hubspot plugin initialization issue, but that might be gone since we removed the sumome plugin from our page

micha16:08:16

next week or so we could do some pair programming if oyu want to work through the issues

micha16:08:52

i spent the day yesterday learning how to use my editor, so that's vastly improved

onetom16:08:03

what is next week for you? because it's monday 12:43am here

micha16:08:30

yeah in like 6 days or so simple_smile

micha16:08:45

weekends are best for me

onetom16:08:00

if you can help to clarify quickly the usage of with-page-load, on-page-load and page-load quickly, that would be probably an immense help

micha16:08:14

oh, that's an affordance for boot-reload

micha16:08:29

it fires when boot-reload tries to reload a js namespace

micha16:08:38

i set it to reload the page when that happens

onetom16:08:41

okay, 6 days from now i should have my adsl connection back too

micha16:08:06

(with-page-load (.. js/window -location reload))

micha16:08:51

boot-reload fires the "page-load" event, and the hoplon with-page-load attaches the body as a callback for that event

micha16:08:11

it does nothing when boot-reload isn't in the pipeline, of course

micha16:08:23

i now realize why this is a bad name

micha16:08:28

with-page-reload

micha16:08:39

is a better name, i think

onetom16:08:02

is the page-load event is something boot-reload specific then?

onetom16:08:16

yeah, definitely better name

micha16:08:19

it should be "namespace-reload"

micha16:08:22

the event

micha16:08:29

or "live-reload"

onetom16:08:36

so for initializaing things like google analytics, we should just use with-init?

micha16:08:50

and the macro maybe (with-live-reload ...)

micha16:08:07

yes, or even (with-timeout 0 ...)

onetom16:08:34

we also got quite confused about these timeout things

onetom16:08:47

there are so many variants of them (at least in the hoplon5 version)

micha16:08:02

there are now only 2

micha16:08:14

(with-timeout n & body)

micha16:08:24

(with-interval n & body)

micha16:08:03

it's just a thin veneer over (js/setTimeout #(fn [] & body) n)

micha16:08:24

and similarly (js/setInterval #(fn [] & body) n)

onetom16:08:36

ok, maybe i shouldn't worry about past version

onetom16:08:03

so why does this (with-timeout 0 ...) works instead of add-initfn! ?

micha16:08:06

yeah we're removing cruft and simplifying many things in h6

onetom16:08:21

the whole hoplon env is already initialized by the time such things run?

micha16:08:43

i'd have to see the thing in action to say exactly

micha16:08:52

i would think they'd be equivalent really

micha16:08:15

i think the initfn stuff is redundant now

onetom16:08:40

alright, i think u gave enough hints so we can answer all these questions for ourselves now. thx.

micha16:08:46

i need to reexamine the code to say for sure

micha16:08:03

but if initfn is redundant we should probably remove it

micha16:08:16

i was hesitant because i didn't want to break existing code

micha16:08:26

maybe mark it as deprecated

onetom16:08:35

yup, that sounds like a good idea

onetom16:08:12

the source is the only documentation for now, so at least that should have some clues about such things..