Hi,

Can we use objects created in native javascript code in our GWT apps?
There's a library I want to use which creates an object and uses it
like:

    Car = new Car();
    car.onDrive = function(ntype, from, to) {
        if (! ntype) {
            whatever();
        }
    }

I wouldn't have a representation of this object in my GWT code, I
guess it would just live in JNDI blocks. But I'm not sure how we go
about doing something like that. In my mind it would look something
like:


public class MyAppGWT implements EntryPoint
{
    public void onModuleLoad()
    {
         // Allocate native js which I want to be persistent
somehow...
         allocateJsObject();
    }

    public static native void allocateJsObject()
 /*-{
        <script src="http://lpath_to_lib_src/GreatLibrary.js";></
script>
        Car car = new Car();
        car.onDrive = function(from, to) {
            return "ok driving?";
    }-*/;

    public static native void driveWrapper()
 /*{
       // Recover the global car instance somehow and use it?
       car.drive("NY", "LA");
    }*/;

Yeah so how will "Car" persist in the application - is it now alive
for the duration of my app, or will it die after allocateJsObject()
exits? The object itself only really takes in  and then produces
text,so I'm guessing it is possible to hook up in some way.

Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to