[aerogear-dev] cordova push plugin simplification

Miguel Lemos miguel21op at gmail.com
Fri Feb 28 09:11:36 EST 2014


+1 ;-)
Em 28/02/2014 13:59, "Erik Jan de Wit" <edewit at redhat.com> escreveu:

> I like this better as well, verse having to put in a if then else block
> based on mobile OS, which is error prone.
>
> Question about the JS syntax above - it looks odd to have the
> configuration object below the function(error), I assume I could have
> declared the config object above and used it as a parameter to
> push.register().   When JS gets too creatively away from old school (e.g.
> Java 1.5) syntax it tends to throw me off.  :-)
>
> How else could the block above be written to look more "straightforward"?
>   keeping in mind that our average user is a Struts/SpringMVC kind of
> developer.
>
>
> Of course we still can make it look like that, this is the same example
> but then without everything inlined still our average user will have to get
> used that we are referencing function ‘pointers’ here
>
> var pushConfig = {
>     pushServerURL: "<pushServerURL e.g http(s)//host:port/context >",
>     alias: "<alias e.g. a username or an email address optional>",
>     android: {
>       senderID: "<senderID e.g Google Project ID only for android>",
>       variantID: "<variantID e.g. 1234456-234320>",
>       variantSecret: "<variantSecret e.g. 1234456-234320>"
>     },
>     ios: {
>       variantID: "<variantID e.g. 1234456-234320>",
>       variantSecret: "<variantSecret e.g. 1234456-234320>"
>     }
> };
>
> push.register(onNotification, errorHandler, pushConfig);
>
> function onNotification(event) {
>   alert(event.alert);
> }
>
> function errorHandler(error) {
>   throw error;
> }
>
>
>
>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20140228/e795d450/attachment.html 


More information about the aerogear-dev mailing list