You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Don Coleman <do...@gmail.com> on 2012/07/13 06:24:19 UTC

Defining NamedArgs for WP7 Plugin

Is a way to allow a WP7 plugin to append a definition to cordova/exec NamedArgs?

Passing the arguments to cordova.exec as a list allows me to use the
same javascript file across platforms.

Passing arguments as an object is a lot cleaner in the WP7 plugin
implementation since I can use JsonHelper.Deserialize.

It looks like the cordova/exec module isolates NamedArgs.  Would it
make sense to add a method for appending data to NamedArgs?

cordova.defineService("HelloPlugin", { hello:["name"] });

Re: Defining NamedArgs for WP7 Plugin

Posted by Jesse MacFadyen <pu...@gmail.com>.
This is a difficulty of the current system, the current command
patch/map for the common-js is waiting for other platforms to
implement named args.

in the meantime, passing an arg of [{key:val,...}] will make it thru
as a json object on all platforms. In iOS land I recommend you use the
mutable dictionary and not the tempting but brittle mutable array.



Cheers,
  Jesse


On 2012-07-12, at 9:24 PM, Don Coleman <do...@gmail.com> wrote:

> Is a way to allow a WP7 plugin to append a definition to cordova/exec NamedArgs?
>
> Passing the arguments to cordova.exec as a list allows me to use the
> same javascript file across platforms.
>
> Passing arguments as an object is a lot cleaner in the WP7 plugin
> implementation since I can use JsonHelper.Deserialize.
>
> It looks like the cordova/exec module isolates NamedArgs.  Would it
> make sense to add a method for appending data to NamedArgs?
>
> cordova.defineService("HelloPlugin", { hello:["name"] });