You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Gord Tanner <gt...@gmail.com> on 2013/10/29 05:09:30 UTC

CommandProxy and misbehaving plugins

Hey everyone,

Long time no commit but I was working on getting cordova 3.X support
working in ripple (really really close and about to release it) but I saw
some weird stuff in some of the plugins.

In the vibration plugin the base javascript calls into the cordova exec
module [1] and does all the work in the native layer, which is perfect.

BlackBerry 10 overrides the base javascript with their own implementation
that just delegates this to navigator.vibrate [2].  This isn't a unique
problem as firefox does the same thing but handles it behind the exec layer
[3].

It would be nice if we could keep each platform as close to being the same
as possible and diverge behind the exec layer (like firefox does).

I saw that windows8 and firefox both have a commandProxy that they use to
add in services and actions for the "native" layer.  I moved this to a
common plugin [4] (since it was duplicated anyway).

Now that this is a common plugin we can use it to override and add in
"native" modules so that BlackBerry and other platforms don't need to
diverge at the javascript API layer making it harder to emulate.


[1] -
https://github.com/apache/cordova-plugin-vibration/blob/master/www/vibration.js
[2] -
https://github.com/apache/cordova-plugin-vibration/blob/master/www/blackberry10/vibrate.js
[3] -
https://github.com/apache/cordova-plugin-vibration/blob/master/src/firefoxos/VibrationProxy.js
[4] -
https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;a=commitdiff;h=c6817556d90cc4e500c4f480b6e106b1b52d3002

Re: CommandProxy and misbehaving plugins

Posted by Lorin Beer <lo...@gmail.com>.
ah, I misunderstood Gord's post.

Yes, this would be a welcome solution to this. +1.


On Tue, Oct 29, 2013 at 10:47 AM, Bryan Higgins <br...@bryanhiggins.net>wrote:

> Lorin - with Gord's generic command proxy vibrate would still execute
> within the main content webview
>
> I'm in favour of using this.
>
>
> On Tue, Oct 29, 2013 at 1:35 PM, Lorin Beer <lorin.beer.dev@gmail.com
> >wrote:
>
> > Hey Gord,
> >
> > handling Vibrate behind the exec layer was attempted, but unfortunately
> > exec calls occur in a separate webview, and the call to vibrate isn't
> > executed.
> > We've talked about a few ways around this, and a jira ticket would be
> > appreciated.
> >
> > - Lorin
> >
> >
> > On Tue, Oct 29, 2013 at 12:20 AM, Jesse <pu...@gmail.com> wrote:
> >
> > > Welcome back!
> > >
> > > Yeah, I chose to make windows8 run the exact same js as the other
> > devices,
> > > and strove for a consistent exec signature. This was the initial goal
> of
> > > having a cordova-js in the first place.
> > > When I saw firefoxos requiring the same kind of functionality, I
> > suggested
> > > they use the same classes, but we were in a hurry, so it was not
> > refactored
> > > into the single module, although this was the plan.
> > >
> > > Incidentally, in 2.9.0 this WAS in it's own module, but it was
> refactored
> > > out so it only existed in the windows8 platform.[1]
> > >
> > > [1]
> > >
> > >
> >
> https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;a=blob;f=lib/common/commandProxy.js;h=e6400038a918174ca02ea889cbe14b82750a8a2b;hb=83dc4bd9010447ea9b93889481516c64a9a46cde
> > >
> > >
> > > @purplecabbage
> > > risingj.com
> > >
> > >
> > > On Mon, Oct 28, 2013 at 9:09 PM, Gord Tanner <gt...@gmail.com>
> wrote:
> > >
> > > > Hey everyone,
> > > >
> > > > Long time no commit but I was working on getting cordova 3.X support
> > > > working in ripple (really really close and about to release it) but I
> > saw
> > > > some weird stuff in some of the plugins.
> > > >
> > > > In the vibration plugin the base javascript calls into the cordova
> exec
> > > > module [1] and does all the work in the native layer, which is
> perfect.
> > > >
> > > > BlackBerry 10 overrides the base javascript with their own
> > implementation
> > > > that just delegates this to navigator.vibrate [2].  This isn't a
> unique
> > > > problem as firefox does the same thing but handles it behind the exec
> > > layer
> > > > [3].
> > > >
> > > > It would be nice if we could keep each platform as close to being the
> > > same
> > > > as possible and diverge behind the exec layer (like firefox does).
> > > >
> > > > I saw that windows8 and firefox both have a commandProxy that they
> use
> > to
> > > > add in services and actions for the "native" layer.  I moved this to
> a
> > > > common plugin [4] (since it was duplicated anyway).
> > > >
> > > > Now that this is a common plugin we can use it to override and add in
> > > > "native" modules so that BlackBerry and other platforms don't need to
> > > > diverge at the javascript API layer making it harder to emulate.
> > > >
> > > >
> > > > [1] -
> > > >
> > > >
> > >
> >
> https://github.com/apache/cordova-plugin-vibration/blob/master/www/vibration.js
> > > > [2] -
> > > >
> > > >
> > >
> >
> https://github.com/apache/cordova-plugin-vibration/blob/master/www/blackberry10/vibrate.js
> > > > [3] -
> > > >
> > > >
> > >
> >
> https://github.com/apache/cordova-plugin-vibration/blob/master/src/firefoxos/VibrationProxy.js
> > > > [4] -
> > > >
> > > >
> > >
> >
> https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;a=commitdiff;h=c6817556d90cc4e500c4f480b6e106b1b52d3002
> > > >
> > >
> >
>

Re: CommandProxy and misbehaving plugins

Posted by Bryan Higgins <br...@bryanhiggins.net>.
Lorin - with Gord's generic command proxy vibrate would still execute
within the main content webview

I'm in favour of using this.


On Tue, Oct 29, 2013 at 1:35 PM, Lorin Beer <lo...@gmail.com>wrote:

> Hey Gord,
>
> handling Vibrate behind the exec layer was attempted, but unfortunately
> exec calls occur in a separate webview, and the call to vibrate isn't
> executed.
> We've talked about a few ways around this, and a jira ticket would be
> appreciated.
>
> - Lorin
>
>
> On Tue, Oct 29, 2013 at 12:20 AM, Jesse <pu...@gmail.com> wrote:
>
> > Welcome back!
> >
> > Yeah, I chose to make windows8 run the exact same js as the other
> devices,
> > and strove for a consistent exec signature. This was the initial goal of
> > having a cordova-js in the first place.
> > When I saw firefoxos requiring the same kind of functionality, I
> suggested
> > they use the same classes, but we were in a hurry, so it was not
> refactored
> > into the single module, although this was the plan.
> >
> > Incidentally, in 2.9.0 this WAS in it's own module, but it was refactored
> > out so it only existed in the windows8 platform.[1]
> >
> > [1]
> >
> >
> https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;a=blob;f=lib/common/commandProxy.js;h=e6400038a918174ca02ea889cbe14b82750a8a2b;hb=83dc4bd9010447ea9b93889481516c64a9a46cde
> >
> >
> > @purplecabbage
> > risingj.com
> >
> >
> > On Mon, Oct 28, 2013 at 9:09 PM, Gord Tanner <gt...@gmail.com> wrote:
> >
> > > Hey everyone,
> > >
> > > Long time no commit but I was working on getting cordova 3.X support
> > > working in ripple (really really close and about to release it) but I
> saw
> > > some weird stuff in some of the plugins.
> > >
> > > In the vibration plugin the base javascript calls into the cordova exec
> > > module [1] and does all the work in the native layer, which is perfect.
> > >
> > > BlackBerry 10 overrides the base javascript with their own
> implementation
> > > that just delegates this to navigator.vibrate [2].  This isn't a unique
> > > problem as firefox does the same thing but handles it behind the exec
> > layer
> > > [3].
> > >
> > > It would be nice if we could keep each platform as close to being the
> > same
> > > as possible and diverge behind the exec layer (like firefox does).
> > >
> > > I saw that windows8 and firefox both have a commandProxy that they use
> to
> > > add in services and actions for the "native" layer.  I moved this to a
> > > common plugin [4] (since it was duplicated anyway).
> > >
> > > Now that this is a common plugin we can use it to override and add in
> > > "native" modules so that BlackBerry and other platforms don't need to
> > > diverge at the javascript API layer making it harder to emulate.
> > >
> > >
> > > [1] -
> > >
> > >
> >
> https://github.com/apache/cordova-plugin-vibration/blob/master/www/vibration.js
> > > [2] -
> > >
> > >
> >
> https://github.com/apache/cordova-plugin-vibration/blob/master/www/blackberry10/vibrate.js
> > > [3] -
> > >
> > >
> >
> https://github.com/apache/cordova-plugin-vibration/blob/master/src/firefoxos/VibrationProxy.js
> > > [4] -
> > >
> > >
> >
> https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;a=commitdiff;h=c6817556d90cc4e500c4f480b6e106b1b52d3002
> > >
> >
>

Re: CommandProxy and misbehaving plugins

Posted by Lorin Beer <lo...@gmail.com>.
Hey Gord,

handling Vibrate behind the exec layer was attempted, but unfortunately
exec calls occur in a separate webview, and the call to vibrate isn't
executed.
We've talked about a few ways around this, and a jira ticket would be
appreciated.

- Lorin


On Tue, Oct 29, 2013 at 12:20 AM, Jesse <pu...@gmail.com> wrote:

> Welcome back!
>
> Yeah, I chose to make windows8 run the exact same js as the other devices,
> and strove for a consistent exec signature. This was the initial goal of
> having a cordova-js in the first place.
> When I saw firefoxos requiring the same kind of functionality, I suggested
> they use the same classes, but we were in a hurry, so it was not refactored
> into the single module, although this was the plan.
>
> Incidentally, in 2.9.0 this WAS in it's own module, but it was refactored
> out so it only existed in the windows8 platform.[1]
>
> [1]
>
> https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;a=blob;f=lib/common/commandProxy.js;h=e6400038a918174ca02ea889cbe14b82750a8a2b;hb=83dc4bd9010447ea9b93889481516c64a9a46cde
>
>
> @purplecabbage
> risingj.com
>
>
> On Mon, Oct 28, 2013 at 9:09 PM, Gord Tanner <gt...@gmail.com> wrote:
>
> > Hey everyone,
> >
> > Long time no commit but I was working on getting cordova 3.X support
> > working in ripple (really really close and about to release it) but I saw
> > some weird stuff in some of the plugins.
> >
> > In the vibration plugin the base javascript calls into the cordova exec
> > module [1] and does all the work in the native layer, which is perfect.
> >
> > BlackBerry 10 overrides the base javascript with their own implementation
> > that just delegates this to navigator.vibrate [2].  This isn't a unique
> > problem as firefox does the same thing but handles it behind the exec
> layer
> > [3].
> >
> > It would be nice if we could keep each platform as close to being the
> same
> > as possible and diverge behind the exec layer (like firefox does).
> >
> > I saw that windows8 and firefox both have a commandProxy that they use to
> > add in services and actions for the "native" layer.  I moved this to a
> > common plugin [4] (since it was duplicated anyway).
> >
> > Now that this is a common plugin we can use it to override and add in
> > "native" modules so that BlackBerry and other platforms don't need to
> > diverge at the javascript API layer making it harder to emulate.
> >
> >
> > [1] -
> >
> >
> https://github.com/apache/cordova-plugin-vibration/blob/master/www/vibration.js
> > [2] -
> >
> >
> https://github.com/apache/cordova-plugin-vibration/blob/master/www/blackberry10/vibrate.js
> > [3] -
> >
> >
> https://github.com/apache/cordova-plugin-vibration/blob/master/src/firefoxos/VibrationProxy.js
> > [4] -
> >
> >
> https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;a=commitdiff;h=c6817556d90cc4e500c4f480b6e106b1b52d3002
> >
>

Re: CommandProxy and misbehaving plugins

Posted by Jesse <pu...@gmail.com>.
Welcome back!

Yeah, I chose to make windows8 run the exact same js as the other devices,
and strove for a consistent exec signature. This was the initial goal of
having a cordova-js in the first place.
When I saw firefoxos requiring the same kind of functionality, I suggested
they use the same classes, but we were in a hurry, so it was not refactored
into the single module, although this was the plan.

Incidentally, in 2.9.0 this WAS in it's own module, but it was refactored
out so it only existed in the windows8 platform.[1]

[1]
https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;a=blob;f=lib/common/commandProxy.js;h=e6400038a918174ca02ea889cbe14b82750a8a2b;hb=83dc4bd9010447ea9b93889481516c64a9a46cde


@purplecabbage
risingj.com


On Mon, Oct 28, 2013 at 9:09 PM, Gord Tanner <gt...@gmail.com> wrote:

> Hey everyone,
>
> Long time no commit but I was working on getting cordova 3.X support
> working in ripple (really really close and about to release it) but I saw
> some weird stuff in some of the plugins.
>
> In the vibration plugin the base javascript calls into the cordova exec
> module [1] and does all the work in the native layer, which is perfect.
>
> BlackBerry 10 overrides the base javascript with their own implementation
> that just delegates this to navigator.vibrate [2].  This isn't a unique
> problem as firefox does the same thing but handles it behind the exec layer
> [3].
>
> It would be nice if we could keep each platform as close to being the same
> as possible and diverge behind the exec layer (like firefox does).
>
> I saw that windows8 and firefox both have a commandProxy that they use to
> add in services and actions for the "native" layer.  I moved this to a
> common plugin [4] (since it was duplicated anyway).
>
> Now that this is a common plugin we can use it to override and add in
> "native" modules so that BlackBerry and other platforms don't need to
> diverge at the javascript API layer making it harder to emulate.
>
>
> [1] -
>
> https://github.com/apache/cordova-plugin-vibration/blob/master/www/vibration.js
> [2] -
>
> https://github.com/apache/cordova-plugin-vibration/blob/master/www/blackberry10/vibrate.js
> [3] -
>
> https://github.com/apache/cordova-plugin-vibration/blob/master/src/firefoxos/VibrationProxy.js
> [4] -
>
> https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;a=commitdiff;h=c6817556d90cc4e500c4f480b6e106b1b52d3002
>