You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Jesse <pu...@gmail.com> on 2012/07/31 22:20:29 UTC

[DISCUSS] cordova-js exec proxy for platforms without native implementations

While writing the Windows 8 JavaScript for cordova-js, it became clear that
if I wanted to use the same input code ( pre-exec calls )
I would have to put a proxy inside exec to maintain the signature, and map
additional JS function calls back to the callbacks.

Some of the goals I have been striving for :
- calls to cordova.exec are identical across different devices, so ALL
platforms can use the same JS.
- use the same plugin code, and add the proxy on the platform that requires
it.

This approach applies to Windows 8, WebWorks, Bada, WebOS, all of which do
not require a native implementation

Here is a new api that is added on top of cordova.exec

cordova.exec.addCommandProxy(str_ID, obj_Proxy ); //:void
cordova.exec.removeCommandProxy(str_ID); //:void

Additionally, it may make sense to have this interface available on other
platforms as well, so we could do things like override the default native
implementation.

Please review the current Windows 8 javascript implementation [1]  and
provide feedback.

[1]
https://github.com/purplecabbage/incubator-cordova-js/blob/a55eb34cf85fe0f328a5f6f7ea5ba43d67b3aec5/lib/win8metro/exec.js

Cheers,
  Jesse


-- 
@purplecabbage
risingj.com

Re: [DISCUSS] cordova-js exec proxy for platforms without native implementations

Posted by Jesse <pu...@gmail.com>.
Yes, there is definitely overlap on these platforms.
I am going to create a branch to throw some stuff together for us to review.



On Tue, Jul 31, 2012 at 1:59 PM, Tim Kim <ti...@gmail.com> wrote:

> The Playbook's plugin manager is very similar to what you are describing
> [1]. In fact, it is the same with the exception of how errors are handled
> and the use of cordova.callbackStatus.
>
> Perhaps we can hash something out so the Playbook/Win8 are more similar and
> then let that be the standard?
>
> [1]:
>
> https://github.com/apache/incubator-cordova-js/blob/master/lib/playbook/plugin/manager.js
>
> On 31 July 2012 13:20, Jesse <pu...@gmail.com> wrote:
>
> > While writing the Windows 8 JavaScript for cordova-js, it became clear
> that
> > if I wanted to use the same input code ( pre-exec calls )
> > I would have to put a proxy inside exec to maintain the signature, and
> map
> > additional JS function calls back to the callbacks.
> >
> > Some of the goals I have been striving for :
> > - calls to cordova.exec are identical across different devices, so ALL
> > platforms can use the same JS.
> > - use the same plugin code, and add the proxy on the platform that
> requires
> > it.
> >
> > This approach applies to Windows 8, WebWorks, Bada, WebOS, all of which
> do
> > not require a native implementation
> >
> > Here is a new api that is added on top of cordova.exec
> >
> > cordova.exec.addCommandProxy(str_ID, obj_Proxy ); //:void
> > cordova.exec.removeCommandProxy(str_ID); //:void
> >
> > Additionally, it may make sense to have this interface available on other
> > platforms as well, so we could do things like override the default native
> > implementation.
> >
> > Please review the current Windows 8 javascript implementation [1]  and
> > provide feedback.
> >
> > [1]
> >
> >
> https://github.com/purplecabbage/incubator-cordova-js/blob/a55eb34cf85fe0f328a5f6f7ea5ba43d67b3aec5/lib/win8metro/exec.js
> >
> > Cheers,
> >   Jesse
> >
> >
> > --
> > @purplecabbage
> > risingj.com
> >
>
>
>
> --
> Timothy Kim
>



-- 
@purplecabbage
risingj.com

Re: [DISCUSS] cordova-js exec proxy for platforms without native implementations

Posted by Tim Kim <ti...@gmail.com>.
The Playbook's plugin manager is very similar to what you are describing
[1]. In fact, it is the same with the exception of how errors are handled
and the use of cordova.callbackStatus.

Perhaps we can hash something out so the Playbook/Win8 are more similar and
then let that be the standard?

[1]:
https://github.com/apache/incubator-cordova-js/blob/master/lib/playbook/plugin/manager.js

On 31 July 2012 13:20, Jesse <pu...@gmail.com> wrote:

> While writing the Windows 8 JavaScript for cordova-js, it became clear that
> if I wanted to use the same input code ( pre-exec calls )
> I would have to put a proxy inside exec to maintain the signature, and map
> additional JS function calls back to the callbacks.
>
> Some of the goals I have been striving for :
> - calls to cordova.exec are identical across different devices, so ALL
> platforms can use the same JS.
> - use the same plugin code, and add the proxy on the platform that requires
> it.
>
> This approach applies to Windows 8, WebWorks, Bada, WebOS, all of which do
> not require a native implementation
>
> Here is a new api that is added on top of cordova.exec
>
> cordova.exec.addCommandProxy(str_ID, obj_Proxy ); //:void
> cordova.exec.removeCommandProxy(str_ID); //:void
>
> Additionally, it may make sense to have this interface available on other
> platforms as well, so we could do things like override the default native
> implementation.
>
> Please review the current Windows 8 javascript implementation [1]  and
> provide feedback.
>
> [1]
>
> https://github.com/purplecabbage/incubator-cordova-js/blob/a55eb34cf85fe0f328a5f6f7ea5ba43d67b3aec5/lib/win8metro/exec.js
>
> Cheers,
>   Jesse
>
>
> --
> @purplecabbage
> risingj.com
>



-- 
Timothy Kim