We pass the scope, the this, around with callbacks. We started doing this before we tried GWT as it's allot quicker to pass two variables (scope and cb) instead of making a closure. Ext.js also uses this. Then the caller just does
cb.call(scope, extra args); I've done this a few times in GWT and it works. If you want an object you can call multiple methods on, I'd use the Exporter stuff at http://code.google.com/p/gwt-exporter/downloads/list It lets you new and call an object multiple times. It also will export your static methods for you, and let you pass objects into them. So it's nice. I currently use a mixture of both to integrate with some legacy code. On Aug 17, 10:37 am, Thomas Broyer <[email protected]> wrote: > On 17 août, 16:31, CI-CUBE <[email protected]> wrote: > > > My workaround is to use static methods (1 for each Callback) in the > > base class that redirect the request to virtual members of a static > > member object. This introduces some overhead but works... anyway is > > there some advice how to use a true member method in an assignment to > > a JS callback? > > > > > protected native void initializeCBs() /*-{ > > var that = this; > $wnd.x4ResizeAppCB = function() { > > [email protected]()(); > }; > > > > > > }-*/; > > It's basically the same as what you described above, without the need > for Java statics. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
