On Friday, September 16, 2016 at 2:54:20 PM UTC+2, Pavel Kakolin wrote:
>
> Imagine an @JsType(isNative = true) EventTarget (basically Element) with
> @JsMethod addEventListener(final String type, final EventListener
> listener).
>
> We have a "mousedown" event listener and inside that listener we
> call
> com.google.gwt.core.client.Scheduler#scheduleFinally(com.google.gwt.core.client.Scheduler.ScheduledCommand).
>
> The problem is the ScheduledCommand is never executed after when mousedown
> event is fired. Scheduler.scheduleDeferred works as expected.
>
Are you sure it's *never* executed? (vs. executed in the "finally" of
another, later "event"?)
> Is it correct behaviour?
>
Actually, yes.
The thing is that JsInterop is "close to the metal", and won't wrap your
JsFunction into $entry() (which takes care of scheduleEntry and
scheduleFinally commands, and GWT.UncaughtExceptionHandler)
I *think* it's by-design.
See
https://gwt-review.googlesource.com/#/q/file:user/src/com/google/gwt/core/client/internal/Entry.java
for examples of rewriting GWT internals with JsInterop, that explicitly
$entry-wrap JsFunctionâ‹…s (that's what's making me say it's by-design)
> Is there any right way to scheduleFinally from inside event listeners
> added to elements using jsinterop?
>
You'd have to somehow wrap your JsFunction into $entry() and actually pass
the $entry-wrapped function to your addEventListener.
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.