Thursday, February 26, 2015

Re: JSO: Why does this fail?

So the answer to
When use it ? When not use it ?

is respectively always and never ? That's easy to follow, thanks!


2015-02-26 14:47 GMT+01:00 Thomas Broyer <t.broyer@gmail.com>:


On Thursday, February 26, 2015 at 2:25:13 PM UTC+1, Mickaël Leduque wrote:
OK thanks, thant would be

    private static <B> Thenable<B> staticThen(Thenable<B> thenable, B arg) {
      return thenable.then(arg);
    }


2015-02-26 13:41 GMT+01:00 Thomas Broyer <t.broyer@gmail.com>:


BTW, you might want to add a bunch of calls to $entry() here and there.


I wondered about that.

I have seen mention of $entry in the doc, but never saw an actual documentation on what it does, when to use it and when not to use it.


Whenever you "enter GWT code" from the outside, wrap that function with $entry().
$entry() will decorate any function and make sure that:
  • exceptions are routed to the GWT.UncaughtExceptionHandler, if any.
  • scheduleEntry / scheduleFinally commands are run
Basically:

function $entry(fn) {
  return function() {
    var _entry = function(fn, args) {
      try {
        runScheduledEntryCommands();
        fn.apply(this, args);
      } finally {
        funScheduledFinallyCommands();
      }
    }
    if (hasUncaughtExceptionHandler) {
      try {
        _entry(fn, arguments);
      } catch (e) {
        callUncaughtExceptionHandler(e);
      }
    } else {
      _entry(fn);
    }
  };
}

--
You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/luuAC9kq2-k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment