$wnd.Array()

31 views
Skip to first unread message

Matt Curry

unread,
Jul 12, 2011, 1:56:58 PM7/12/11
to Google Web Toolkit
Hey guys,

I am integrating with a library that has a function that looks like
this:
function splat(obj) {
if (!obj || obj.constructor !== Array) {
obj = [obj];
}
return obj;
}

I was sending JsArray instances to it and noticed that it was always
wrapping the object in a new array. I believe that this is because
GWT is running in a hidden iframe.

Therefore I created a jsni method:

public static native JsArray<JavaScriptObject> createArray()/*-{return
new $wnd.Array();}-*/;

This works on the PC. However on firefox and safari on the mac it
does not work. It still always wraps the object in a new array.

Does anyone have any suggestions?

Thank you very much for your help.

Matt Curry

Thomas Broyer

unread,
Jul 12, 2011, 3:23:49 PM7/12/11
to google-we...@googlegroups.com
Well, first, fix the library so it works cross-window/cross-frame.

As a workaround, I think you can use the xs linker, which won't use an iframe: <add-linker name="xs" />
Reply all
Reply to author
Forward
0 new messages