Fork me on GitHub
#boot
<
2016-01-29
>
laforge4900:01:16

So I moved the html to an assets directory and added that to the resource paths.

laforge4900:01:50

Now the html comes up but I get a log error of Uncaught ReferenceError: document is not defined

laforge4900:01:12

:9000/main.js:2

micha00:01:42

yeah i'm trying to figure that one out

micha00:01:59

it makes no sense to me since document is part of the built-in things inthe browser

richiardiandrea00:01:44

I agree, but you need to access it through js/document though

micha00:01:50

and clearly base.js is being written

micha00:01:58

you can see it in the html

micha00:01:10

@richiardiandrea: this is just plain javascript

laforge4900:01:25

Do we need to do an on-load or somethin? Remember, all this stuff is about 2 years old that I'm converting.

micha00:01:30

if(typeof goog == "undefined") document.write('<script src="main.out/goog/base.js"></script>');

micha00:01:55

clearly document.write is being called

laforge4900:01:05

yeah, with no document

micha00:01:05

because you can see that script tag in the html in the dev tools

laforge4900:01:14

the code is invoked twice, the second time from the webworker which DOES NOT HAVE A DOCUMENT!

micha00:01:28

ok that is starting to make sense now

laforge4900:01:46

hey, at least I'm good for somethin!

micha00:01:02

both times must be from the webworker i guess

micha00:01:10

because in the main page everything looks okay

laforge4900:01:17

I ran this today using lein. everything was fine

micha00:01:22

it really sucks that you don't have a stack trace there

laforge4900:01:42

but I know where it happened. there are 2 webworkers.

micha00:01:18

you probably don't want to load the main.js in the webworker

micha00:01:32

well you do, but you don't want :none optimizations probably

laforge4900:01:36

worked with lein.

micha00:01:44

lol i don't know what to tell you

micha00:01:53

i haven't used lein in a long time

laforge4900:01:55

look at the project.clj file

micha00:01:59

but i hear it's pretty awesome

laforge4900:01:04

:optimizations simple_smile

laforge4900:01:22

: simple, not : simple_smile :

laforge4900:01:54

lein is dead, long live boot. I just need to learn it!

laforge4900:01:15

I added the simple optimization, same issue of course

laforge4900:01:51

well, except it is now saying that window is not defined in main.js.2437

micha00:01:37

this looks like it's a reload issue

micha00:01:51

if you comment out the reload task it looks like it works

laforge4900:01:38

Now any pointers on where I can learn about creating multiple js files?

micha00:01:36

you just make two .cljs.edn files

micha00:01:56

like src/main.cljs.edn and src/worker.cljs.edn

micha00:01:06

then you will have main.js and worker.js

laforge4900:01:37

Where can I see a sample?

micha00:01:40

the example project there is a good start https://github.com/adzerk-oss/boot-cljs-example

micha00:01:26

the links in boot-cljs repo have pretty much all info you could need

laforge4900:01:39

I'll need to dig some, as the build.boot file is not clear to me. But at least I have a starting point. Thanks!

laforge4900:01:50

(see film at 11)

micha00:01:06

there is a main.cljs.edn file in there

laforge4900:01:16

Yes, saw that

richiardiandrea00:01:05

@micha basically my yesterday's problem was that I am testing inside (boot ... some sift function but in the same build.boot so I need a way to reset the fileset at will

richiardiandrea00:01:26

but take your time, the PR is there, you can also answer there 😄

micha01:01:54

interestingly, this document indicates that web workers should have a window object

micha01:01:36

oh nevermind i'm dumb

laforge4901:01:28

I was just going to say, http://www.w3schools.com/html/html5_webworkers.asp Since web workers are in external files, they do not have access to the following JavaScript objects: The window object The document object The parent object

laforge4901:01:22

What I want to do next is to create a hoplon demo built on the webworker example in the above link.

laforge4901:01:22

And this: Here, we create a script that counts. The script is stored in the "demo_workers.js" file: var i = 0; function timedCount() { i = i + 1; postMessage(i); setTimeout("timedCount()",500); } timedCount();

micha01:01:00

in the mozilla docs they show making a web worker where the javascript it runs is in a string

micha01:01:18

so you could dynamically generate that via clojurescript macros i imagine

micha01:01:08

probably be similar to the way the repl works

laforge4901:01:41

yeah, you can use a blob to create a .js "file" that will work with a webworker. But then you need to add the libraries. So I think it is just easier to create a separate .js file in the build for the webworker.

micha01:01:58

definitely easier for now

micha01:01:08

but i could imagine doing some cool things

micha01:01:12

like pods basically

micha01:01:26

no reason why you couldn't use web workers like a boot pod

laforge4901:01:43

if Iunderstood boot pods!

laforge4901:01:01

--one step at a time, ok? 😄

laforge4901:01:35

I'm slow because I'm focused on using this stuff. It does not get any more than the minimum necessary attention from me. Proficiency, yes. Extra features, no.

micha01:01:09

a solid approach yes

laforge4902:01:22

Ilearned that indexedDb is the way to go for file i/o, and that it runs best in a webworker. Webworkers work best with their own js file. So now I want to learn about creating multiple output files. It is a bit indirect, but quite different from trying to swallow boot whole, hmm?

laforge4902:01:06

There is so much tech that I'd really like to know more about, including awt, boot, etc. But I tend to be quite defensive about maintaining my productivity and selective about what I learn and when.

laforge4902:01:18

I'm sure if you look in aatree/aautil you will see no pattern to my choices of snippets there. But they are all things that are in my critical path to cljc db development. I think aautil is really all about making cljc easier to write.

laforge4903:01:59

OK, after a nice break I looked at this again and it seemed clear, unlike before simple_smile https://github.com/adzerk-oss/boot-cljs-example/blob/master/build.boot

laforge4903:01:31

But what on earth is .travis.yml????

jethroksy04:01:46

@laforge49: travis is for CI

jethroksy04:01:07

unrelated to the workings of boot

nayzak04:01:45

Hi! I'm wondering does boot-reload accept new CSS styles on the page after it reloads css file?

pesterhazy12:01:23

Looking at the boot-reload task to use in conjunction with react-native. I've got a patch ready to make it work, but am wondering how to expose the "dom-less" mode best. @martinklepsch ?

pesterhazy12:01:44

basically we need one more change in addition to not adding the HUD

martinklepsch12:01:54

@pesterhazy: I'm in favor of a runtime check that ensures a DOM is available

martinklepsch12:01:05

@pesterhazy: CSS reloading that is right?

pesterhazy12:01:22

(doto changed*
      reload-html
      reload-css
      reload-img)
`

pesterhazy12:01:43

this needs to go (none of these apply I think)

pesterhazy12:01:18

any idea on how to check for DOM reliably?

martinklepsch12:01:33

So I think if we can do a dom-available? thing that'd be best. We could also check for RN but then there are cases like webworkers, node etc.

pesterhazy12:01:21

@martinklepsch: add an option to a boot task, or add a fn to check automatically?

martinklepsch12:01:42

I'd prefer guards added to the functions. Better out of the box experience and can't do much wrong I think.

pesterhazy13:01:26

(defn has-dom?
  "Perform heuristics to check if a non-shimmed DOM is available"
  []
  (boolean (aget js/window "document" "documentURI")))

pesterhazy13:01:29

how about this?

martinklepsch13:01:23

@pesterhazy: if that does it for you with react-native lets go with that

martinklepsch13:01:45

please don't use aget for property access though

pesterhazy13:01:45

yup. I'd guess that should return true for every browser env

martinklepsch13:01:09

(and (exists? js/window) (exists? js/window.document) ...)

pesterhazy13:01:11

is that safe (i.e. won't throw errors) in all circumstances?

martinklepsch13:01:25

if you check them step wise yes

pesterhazy13:01:26

(also, what's wrong with aget?)

martinklepsch13:01:48

aget is array accessor and that it works for objects is an implementation detail you should not rely on

pesterhazy13:01:10

really? I never knew!

martinklepsch13:01:42

there have been a bunch of conversations in #C03S1L9DN around this unfortunately can't point you to any "source of truth" now

pesterhazy13:01:51

I believe you simple_smile

martinklepsch13:01:02

better don't 😄

pesterhazy13:01:16

oh, and referring to js/window.document.documentURI won't generate warnings if that doesn't exist?

pesterhazy13:01:26

compiler warnings, that is

martinklepsch13:01:32

nope, compiler can't know what will be in js/ simple_smile

pesterhazy13:01:00

oh, I also thought that disabled-hud is a bit unfortunate

pesterhazy13:01:05

how about disable-hud ?

martinklepsch13:01:26

oh, thought it was disable-hud, PR welcome

martinklepsch13:01:41

since this is not yet released also good timing simple_smile

pesterhazy13:01:13

I'll open a PR once we've verified the fix

pesterhazy13:01:06

if I do boot build in that directory, will it install a snapshot release to my local maven repo?

pesterhazy13:01:16

i.e. how do I refer to it correctly?

martinklepsch13:01:24

boot-build-jar

martinklepsch13:01:48

boot build is correct, I think it prints the used version when installing

martinklepsch13:01:23

and yes build installs to local maven

pesterhazy13:01:41

ok, so no SNAPSHOT needed?

martinklepsch13:01:22

not unless you changed the version in build.boot

micha15:01:39

@richiardiandrea: sorry i've been remiss lately, trying to get some projects finished deadlines looming, you know simple_smile

micha15:01:17

i'll have some breathing room soon

richiardiandrea21:01:47

Hello guys, I found the time to create a representation of a TmpFileSet for testing

richiardiandrea21:01:10

it is very useful in understanding the innards of boot and in other projects they put it as sample data and stored in an .edn (I saw this in https://github.com/cljsinfo/cljs-api-docs)

richiardiandrea21:01:06

I just need @micha help for the description of :bdir :blob and :scratch 😄

micha21:01:43

@richiardiandrea: we can do a hangout tomorrow if you like

micha21:01:55

a google hangout/skype/whatever

kanwei21:01:50

does the boot cache ever auto-cleanup?

kanwei21:01:55

huge files in .boot/cache

micha21:01:01

@kanwei: you can delete ~/.boot/cache whenever you like

micha21:01:12

well except while boot is running, that might do something weird

micha21:01:00

no auto-cleanup is done

micha21:01:36

well actually stuff in ~/.boot/cache/tmp is garbage collected

micha21:01:45

but otherwise no

micha21:01:12

sorry for the scattered response simple_smile

kanwei21:01:01

i use capistrano for deploys and it created a new cache folder for each release

kanwei21:01:04

and got pretty huge

kanwei21:01:19

could be an issue if people don't notice simple_smile