Re: jsinterop and Scheduler.scheduleFinally
> > Are you sure it's *never* executed? (vs. executed in the "finally" of > another, later "event"?) > In our synthetic test with one element and one event listener, yes, it's never executed. If we add another event listener in the old way eg using Window#addResizeHandler, then command scheduled from mousedown event is executed on window resize. You'd have to somehow wrap your JsFunction into $entry() and actually pass > the $entry-wrapped function to your addEventListener. > Your point is clear. I think we will figure something out, eg in our case "finally" nature of scheduled command does not matter much and we can easily replace scheduleFinally call with call to @JsMethod setTimeout of @JsType Window or something like this. -- 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.
Re: jsinterop and Scheduler.scheduleFinally
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.
jsinterop and Scheduler.scheduleFinally
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. Is it correct behaviour? Is there any right way to scheduleFinally from inside event listeners added to elements using jsinterop? The issue is reproducible in gwt-2.8.0-beta2. -- 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.