On 20 juil, 22:26, mike <[email protected]> wrote:
> Darth, ...ahh, great thanks.
>
> I got to $wnd to work for code in the cross-site communication
> tutorial. I think the problem was that I was using "document and $wnd"
> rather than "$doc and $wnd". I haven't completely worked out in my
> head why the former wouldn't work but it seems sensible that you would
> need to make sure it's all either happening on the host page or all in
> the iframe.
You add your script node to 'document' (which lives in 'window') but
you define the callback function in $wnd. When the script loads, it
calls a function called "callback<ID>" (where ID is a counter); in
JavaScript, this is equivalent to calling window.callbackID (because
'window', and window.window, and window.window.window, and etc. is the
"global object"); but as I said before, the function doesn't exist, as
it has been actually defined in $wnd.
Incidentally, if you <add-linker name="xs" /> in your gwt.xml, it'll
work, because in this case $wnd == window and $doc == document.
> Any guess why the tutorial uses window/document rather than $wnd/
> $doc ?
That way, it doesn't "pollute" the window name space (only the $wnd
name space, which is only ever used by your GWT compiled code), as it
uses "window[something] = ..." constructs (incidentally, if you <add-
linker name="xs" />, it *will* pollute the window namespace).
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---