[aerogear-dev] cordova push plugin simplification
Burr Sutter
bsutter at redhat.com
Fri Feb 28 12:48:09 EST 2014
On Feb 28, 2014, at 8:59 AM, Erik Jan de Wit <edewit at redhat.com> wrote:
>> 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
This is much more readable for me!
> 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/580d98e7/attachment.html
More information about the aerogear-dev
mailing list