his / gwt-gae-channel

Automatically exported from code.google.com/p/gwt-gae-channel
0 stars 0 forks source link

Channel.java should use $entry in its JSNI methods #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
According to 
https://developers.google.com/web-toolkit/doc/latest/DevGuideCodingBasicsJSNI#ca
lling, a call from a non-GWT context to a GWT function should be wrapped with a 
call to $entry to catch exceptions, etc.

Two ways to do this (using unqualified Java class names for exposition purposes 
only):

1. Wrap the entire JS callback method:

  socket.onopen = $entry(function(event) {
    listener.@SocketListener::onOpen()();
  });

2. Just wrap the Java method:

  socket.onopen = function(event) {
    $entry(listener.@SocketListener::onOpen())();
  };

(N.B., this is $entry(f)(), not $entry(f()).)

Original issue reported on code.google.com by mdemp...@google.com on 3 Apr 2012 at 8:05