>
> When I use $wnd.Snap, I get:
>
> Object [object global] has no method 'Snap'
>
>
> And the first library (SVGJS) works without $wnd. 
>
> I inject like this:
>   LibraryBundle b = GWT.create (LibraryBundle.class);
>   ScriptInjector.fromString (b.svgLib().getText()).inject();
>

If you use $wnd you MUST inject into the top level window, so you have to 
change your injection as well by calling 
setWindow(ScriptInjector.TOP_WINDOW).
 


   When injecting your script, make sure you inject it into the top window 
> (setWindow(ScriptInjector.TOP_WINDOW)), then reference your globals within 
> $wnd.
>
> How exactly would you modify the injection code above?
>

Ehh...by calling setWindow() as already mentioned?


 

> (How does setWindow influence where the code gets injected?)
>

By default ScriptInjector uses the JS object "window" to inject your code. 
When inside an iframe "window" points to the iframe window, so code gets 
injected into the iframe. When you tell ScriptInjector to inject into the 
top window it will use GWT's special JS variable "$wnd" which always points 
to the top level window.
 

 I suppose your errors come from using nodes cross-document (the container 
> in the top window, the SVG in the hidden iframe that sandboxes the GWT 
> compiled code)
>
> How can I verify (with Chrome inspector) where the code gets injected?
>

ScriptInjector removes the <script> tag it has injected automatically to 
keep the DOM smaller. To see the <script> tag you need to call 
setRemoveTag(false). Then take a look at the <script> tags of the top level 
document or GWT's iframe (the one having an id assigned matching your 
module name).

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to