Actually, it might be possible to do it with JsInterop only:

class Globals {

        @JsMethod(namespace=GLOBAL)
        public native Object eval(String expresion);
        
        @JsOverlay
        public native boolean isVariableDefined(String varName){
             return Boolean.TRUE.equals(eval("!!window['"+varName+"']"));
        }

}

I guess, you can also use JSON.safeEval() ... but we dont know if will 
survive  in J2CL.


On Wednesday, May 25, 2016 at 12:21:26 PM UTC-7, Hristo Stoyanov wrote:
>
> Jens,
> Thanks, so apparently JsInterop cannot be a complete replacement of JSNI?
>
> I was hoping to be able to wrap in @JsType(native = true) something like 
> Object.keys(window) 
> <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys>
>
> On Tuesday, May 24, 2016 at 5:11:39 PM UTC-7, Jens wrote:
>>
>> You still need to use JSNI for accessing these properties. Depending on 
>> the API you want to build you could define @JsOverlay methods inside 
>> @JsType(native = true) classes and let them delegate to a JSNI based 
>> utility class.
>>
>> -- J.
>>
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" 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 https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to