Fork me on GitHub
#shadow-cljs
<
2019-05-05
>
polymeris01:05:26

It seems to help, thank you. The error went away, haven't checked if it is behaving correctly.

genRaiy08:05:48

@thheller hey Thomas, just want to say thanks for the ncc tip - it’s a life saver and would have been a tough tool for me to find independently

👍 4
Stefan08:05:28

@thheller The solution I was so happy about yesterday is working on iOS, but not on Android; I’m getting “failed to load” errors for every line SHADOW_ENV.evalLoad("shadow.animate.js", true , "goog.provide [...] (from the file compiled with :devtools {:loader-mode :eval}). I’m not sure how to get more details about this error, I have gotten this by changing console.log to add its argument to document.body.innerHTML… Does this ring any bells? Any hints?

thheller08:05:19

well why did it fail to load? there should be more info

thheller08:05:46

console.warn("failed to load", path, e);

thheller08:05:54

maybe you do not capture all of those args

thheller08:05:11

need to know what e is

Stefan08:05:18

right i’ll try

Stefan08:05:57

path is the first parameter to evalLoad; e is empty… (`JSON.stringify(arguments)` yields {"0":"failed to load","1":"audio.engine.js","2":{}})

thheller08:05:25

try {
      goog.globalEval(code);
    } catch (e) {
      console.warn("failed to load", path, e);
    }

thheller08:05:00

it might just not be stringify-able. try accessing e.message or e.stack

Stefan08:05:16

message: “goog.provide is not a function”. This function is in fact in the javascript string, I checked…

Stefan08:05:10

Earlier I noticed another difference between iOS and Android webview. Not sure if related. When I declare functions and inject them into the webview (using injectedJavaScript), I could not call them directly on Android. As a work-around I assigned them to the document (e.g. document.play = play) and then called document.play(), that worked…

Stefan08:05:38

In other words: maybe something about the scope where these functions are declared in or something?

thheller09:05:03

hmm thats odd. appears like the global scope is different from the scope that loaded the initial file

thheller09:05:27

you can change the generated output

thheller09:05:44

and swap the goog.globalEval(code); with just eval(code);

thheller09:05:11

that might work

Stefan09:05:22

Everywhere you mean I guess?

thheller09:05:39

it only occurs once

thheller09:05:38

eval is weird if you can't eval in the global scope

Stefan09:05:35

I see a couple of invocations (inside if (!COMPILED && goog.defineClass.SEAL_CLASS_INSTANCES). I’ll tinker a bit with it. I gotta do some family stuff, can’t delay anymore 😕 I’ll try later.

thheller09:05:47

try {
      goog.globalEval(code);
    } catch (e) {
      console.warn("failed to load", path, e);
    }

thheller09:05:53

this part ... that only occurs once

Stefan09:05:12

Yes indeed, thanks

Stefan09:05:44

Maybe I commented out too many of those SHADOW_ENV.evalLoad.

Stefan09:05:42

No that wasn’t it.

thheller09:05:32

its a different error at least

Stefan09:05:19

There’s some more when I uncomment all code again.

thheller09:05:34

well you can't comment out anything

thheller09:05:38

they all need to be loaded

thheller09:05:56

so if one fails they all fail

Stefan09:05:58

Yeah I was just seeing what would happen

Stefan09:05:26

The last screenshot is with everything loaded again

thheller09:05:37

yeah as I said .. if one fails they all fail

thheller09:05:47

and the first fails because the scope isn't right

thheller09:05:19

I don't know why the scope is different or how is different compared to the android version

thheller09:05:23

and I can't dig into it

Stefan09:05:02

I understand, know that you have confirmed that that is likely indeed the problem, I’ll investigate further. I’ll let you know; thanks!