Perfect!
Steve, my hero

On Monday, January 22, 2018 at 4:30:11 PM UTC+2, Steve Hannah wrote:
>
> Use BrowserComponent.addJSCallback() instead.  Some examples in the 
> GoogleMaps lib
>
> https://github.com/codenameone/codenameone-google-maps/blob/master/GoogleMaps/src/com/codename1/googlemaps/MapContainer.java#L352
>
> Yours would be something like
>
> myBrowserComponent.addJSCallback("window.test=function(msg){callback.onSuccess(msg)}",
>  
> msg -> {
>     String msgStr = msg.stringValue();
>     System.out.println(msgStr);
> });
>
> On Mon, Jan 22, 2018 at 6:20 AM, <[email protected] <javascript:>> wrote:
>
>> Hi guys,
>> I just love CN1 and am playing around with the Java/Javascript 
>> interoperability in the BrowserComponent.
>> The problem I have is that the working code has deprecated classes and I 
>> cannot find a good example of how to do it without using deprecated code.
>>
>> Currently this works :
>>        
>>
>>
>>
>>
>>
>>
>> * JavascriptContext ctx = new JavascriptContext(browser);        JSObject 
>> test = (JSObject) ctx.get("window");        test.set("call", new 
>> JSFunction() {            public void apply(JSObject self, Object[] args) 
>> {                String msg = (String) args[0];                
>> System.out.println("window.call was executes");            }        }); *
>> Deprecated classes: *JavascriptContext,JSObject*
>> Please give me a hint on how to NOT use the deprecated Classes to call 
>> Java from Javascript.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "CodenameOne Discussions" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] 
>> <javascript:>.
>> Visit this group at 
>> https://groups.google.com/group/codenameone-discussions.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/codenameone-discussions/b6194ee7-411c-4b68-8cb4-b05cf50f1cbe%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/codenameone-discussions/b6194ee7-411c-4b68-8cb4-b05cf50f1cbe%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Steve Hannah
> Software Developer
> Codename One
> http://www.codenameone.com
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/7f2806a7-90ac-4862-99ca-4eceaff9633c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to