cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse <purplecabb...@gmail.com>
Subject Re: Question about bypassing the run-loop wait/entire bridge for plugins on iOS
Date Mon, 20 Apr 2015 22:40:39 GMT
I think you are best off to experiment and see what you can get working
consistently.  The focus lately has been on the wkwebview bridge, which is
entirely new, while the current webview implementation is a collection of
workarounds for various issues.

If you can distill this down to a simple project that demonstrates the
issue, I would be happy to have a look.




@purplecabbage
risingj.com

On Mon, Apr 20, 2015 at 3:25 PM, Tim Lancina <tim@drifty.com> wrote:

> Whoops should probably have subscribed to the mailing list! Apologies if
> this screws up the thread.
>
> Thanks for your response Jesse. The problem is knowing when to start the
> css animation, hence why it would be best to be able to fire an event
> indicating the keyboard is about to show as quickly as possible.  If you
> wait for the run-loop, the animation will be behind by an arbitrary amount
> by the time it receives the event.  This isn't the end of the world, it
> just isn't as smooth and simultaneous as native.
>
> In the case of the keyboard plugin, all it does is trigger an event on the
> document indicating the keyboard will show/hide.  So if I'm understanding
> correctly, it would be better to leave the default evalJS
> scheduledOnRunLoop:YES call because the handlers for those events fired by
> the plugin could in theory result in more calls to native, correct?
>
> I suppose we could fire one event immediately, with the stipulation that
> handlers for the event shouldn't trigger any native calls, and another
> marginally slower, 'safe' event that could be used in most circumstances.
>
> If I'm making any false assumptions or overlooking something, please let me
> know!
>
> Best,
> Tim
>
> On Mon, Apr 20, 2015 at 4:45 PM, Josh Bavari <jbavari@gmail.com> wrote:
>
> >
> > ---------- Forwarded message ----------
> > From: Jesse <purplecabbage@gmail.com>
> > Date: Mon, Apr 20, 2015 at 1:39 PM
> > Subject: Re: Question about bypassing the run-loop wait/entire bridge for
> > plugins on iOS
> > To: "dev@cordova.apache.org" <dev@cordova.apache.org>
> >
> >
> > If you can be sure that your calls into js will not result in more calls
> > back to native, then it is probably fine. Delegating back to the main
> > thread may have similar performance trouble though ...
> >
> > For this specific case, can't you use a timed css animation that matches
> > the keyboard animation?
> >
> >
> >
> > @purplecabbage
> > risingj.com
> >
> >
> > On Mon, Apr 20, 2015 at 12:18 PM, Tim Lancina <tim@drifty.com> wrote:
> >
> > > Hey Andrew,
> > >
> > > Just had a quick question about plugins on iOS.  For the keyboard
> plugin
> > > we're using evalJS to fire an event when the keyboard shows, which by
> > > default waits for the run loop to cycle before executing any JS.  My
> > > question is, would terrible things happen if we didn't wait, or even
> just
> > > went straight stringByEvaluatingJavaScriptFromString?  I can see from
> the
> > > commented code (
> > >
> > >
> >
> https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/CDVCommandDelegateImpl.m#L83
> > > )
> > > that there are certain scenarios where it looks like you need to wait,
> > but
> > > was wondering if those are extreme edge cases or regular occurrences.
> > >
> > > The reason I'm asking is that we had someone bring up an issue on the
> > Ionic
> > > issue tracker about getting the keyboard plugin to fire quickly enough
> so
> > > they could animate an element along with the keyboard animation like on
> > > native.  The issue is here:
> > https://github.com/driftyco/ionic/issues/3537,
> > > but I was hesitant to give them a definitive answer on either bypassing
> > the
> > > wait or not.  It would also be nice to update the plugin if bypassing
> the
> > > wait isn't an issue in most cases.
> > >
> > > Cheers,
> > > Tim
> > >
> >
> >
> >
> > --
> > "Clear thoughts produce clear results."
> > Josh Bavari
> > Application Developer
> > Phone: 405-509-9448
> > Cell: 405-812-0496
> > Email: jbavari@gmail.com
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message