Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vvvv.js does not show up in Chrome's debugging tools #6

Closed
ccoenen opened this issue Jul 6, 2012 · 12 comments

Comments

@ccoenen
Copy link
Contributor

commented Jul 6, 2012

The current loading process injects script-elements via $(...).append('<script>') this way they don't show up in FireBug or Chrome's debug tools.

@zauner

This comment has been minimized.

Copy link
Owner

commented Jul 6, 2012

Yeah, that is in fact pretty annoying.

For VVVV.js dynamically loading the scripts has two purposes:
1 - to only have to inlcude one script, of course
2 - to be able to load only the scripts containing the nodes required by the current patch (in a future release)

As far as my research went so far (without actually trying), other methods like head.js or $.loadScript will result in the same problem.

However, for development/debugging purposes I use to have an HTML file loading the scripts statically. initVVVV() will then not dynamically load them, if already present.

Of course, that's not at all satisfying, and needs some better solution. Any hints very much appreciated.

@ccoenen

This comment has been minimized.

Copy link
Contributor Author

commented Jul 6, 2012

i am currently rewriting it to use the default DOM-Script syntax like this:

var head = document.getElementsByTagName('head')[0];
var script = document.createElement( 'script' );
script.src = url; // prepard url, comes from somewhere else
head.appendChild(script);

This works for the debugging part, but it appears to alter the load-order, so that this line will fail https://github.com/zauner/vvvv.js/blob/master/vvvv.js#L71 (fails because VVVV.Core.VVVVConnector is undefined)

I'll try some more. If i succeed i'll post a pull-request.

@ccoenen

This comment has been minimized.

Copy link
Contributor Author

commented Jul 6, 2012

the reason appears to be, that jQuery treats script tags differently. They are said to be eval'd instead of added to the DOM. (discussed here: http://stackoverflow.com/a/3603496)

@zauner

This comment has been minimized.

Copy link
Owner

commented Jul 6, 2012

Alright, seen.

That would be the reason, why the line you mentioned raises an error: $('head').append('') blocks until the script has been transfered and evald, while simply adding the tag to the DOM will return immediatly, leaving the loading to something else.

ccoenen added a commit to meso-unimpressed/vvvv.js that referenced this issue Jul 6, 2012

@ccoenen

This comment has been minimized.

Copy link
Contributor Author

commented Jul 6, 2012

it's not ready for prime-time, yet, but i'd like your opinion on this one:
meso-unimpressed@68abd93

Loading will add the dom-elements (asynchronously loaded), it counts the number of inserted elements (var loadCounter). All Scripts call loadMonitor(). Once all scripts are accounted for, i'll continue initiallisation.

You'll then have to use a callback in your actual code (since you need to wait for completion as well), i demonstrate this in example 01_canvas_arcs. If you're satisfied, i'll of course alter the other examples as well.

Let me know what you think.

another possibility would be to set script.async = false (i haven't tested this yet, but it should have the same effect as before). I don't think this is the better choice, though. Whenever vvvv.js is only one piece of the puzzle, i'd rather avoid blocking other people's scripts.

@ccoenen

This comment has been minimized.

Copy link
Contributor Author

commented Jul 6, 2012

i think it's pretty stable now. It also works with all the examples (except for 09). I worked in the loading-branch

@zauner

This comment has been minimized.

Copy link
Owner

commented Jul 6, 2012

oja, that looks really great.

I will try it later, and see what's wrong with example 9.

@zauner

This comment has been minimized.

Copy link
Owner

commented Jul 6, 2012

Ok, just tried it -- pretty cool.

Firefox however complains about not enough arguments for removeEventListener, it seems to need the callback as the second argument.

Regarding example 9: I adjusted it by removing the "static" <script> tags and calling VVVV.init using the callback, and it worked fine.

Which errors did you experience with example 9? If it's just a blank screen, that's perfectly ok, since the example is all about connecting to VVVV and live patching

@ccoenen

This comment has been minimized.

Copy link
Contributor Author

commented Jul 6, 2012

Yes, it was the blank screen that threw me off. I'll have a look at firefox right now. I can test other browsers as well, if you like. Is there any "minumum requirement" or list of supported browser i should check against?

@zauner

This comment has been minimized.

Copy link
Owner

commented Jul 6, 2012

Hm Safari worked in most cases up to now, maybe you could check that, because I don't have one here right now.

@ccoenen

This comment has been minimized.

Copy link
Contributor Author

commented Jul 6, 2012

Firefox is now working. Safari kind-of works, but some demos (01 and all of the WebGL based demos) won't work. But besides that there's no error in Safari.

@zauner

This comment has been minimized.

Copy link
Owner

commented Jul 6, 2012

Very nice, merged and pushed. Thank you! :)

@zauner zauner closed this Jul 6, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.